1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00

Fix a PHP 8.1/8.2 deprecated use of ltrim and rtrim with a NULL argument

Summary:
These calls were preventing notification servers configuration to be properly initialized.
Indeed, PHP 8.X is stricter concerning
This behavior is deprecated since PHP 8.1. Phorge adopts phutil_nonempty_string() as a replacement.

Fix T15598

Test Plan:
Sign in as an administrator, configure the notification server without filling admin path field,
you shouldn't get both an RuntimeException and a warning indicating that Phorge is unable to connect
to Notification Server but a message indicating that everything is fine.

Reviewers: O1 Blessed Committers, valerio.bozzolan, avivey

Reviewed By: O1 Blessed Committers, valerio.bozzolan, avivey

Subscribers: avivey, Cigaryno, Matthew, valerio.bozzolan, tobiaswiese, speck

Maniphest Tasks: T15598

Differential Revision: https://we.phorge.it/D25382
This commit is contained in:
bob 2023-08-17 10:41:12 +02:00
parent 17befe9bca
commit 747d7db241

View file

@ -143,8 +143,10 @@ final class PhabricatorNotificationServerRef
return ($this->type == 'admin');
}
public function getURI($to_path = null) {
$full_path = rtrim($this->getPath(), '/').'/'.ltrim($to_path, '/');
public function getURI($to_path = '') {
$path = coalesce($this->path, '');
$to_path = coalesce($to_path, '');
$full_path = rtrim($path, '/').'/'.ltrim($to_path, '/');
$uri = id(new PhutilURI('http://'.$this->getHost()))
->setProtocol($this->getProtocol())