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
Differential D25382
Fix a PHP 8.1/8.2 deprecated use of ltrim and rtrim with a NULL argument bob on Aug 10 2023, 08:28. Authored by
Details
These calls were preventing notification servers configuration to be properly initialized. Fix T15598 Sign in as an administrator, configure the notification server without filling admin path field,
Diff Detail
Event TimelineComment Actions There is definitely something about arc tool philosophy that I miss... This modification consists in removing files associated with in other diff. Comment Actions Thanks! This seems totally backward compatible to me var_dump(rtrim(null, '/').'/'.ltrim(null, '/')); // → string(1) "/" // ---------------- require_once '../arcanist/src/__phutil_library_init__.php'; $a = null; $b = null; $full_path = '/'; if (phutil_nonempty_string($a)) { $full_path = rtrim($a, '/').$full_path; } if (phutil_nonempty_string($b)) { $full_path = $full_path.ltrim($b, '/'); } var_dump($full_path); // → string(1) "/" php > var_dump(rtrim("/asd/asd///", '/').'/'.ltrim("///asd/asd/", '/')); // → string(17) "/asd/asd/asd/asd/" // ---------------- require_once '../arcanist/src/__phutil_library_init__.php'; $a = "/asd/asd///"; $b = "///asd/asd/"; $full_path = '/'; if (phutil_nonempty_string($a)) { $full_path = rtrim($a, '/').$full_path; } if (phutil_nonempty_string($b)) { $full_path = $full_path.ltrim($b, '/'); } var_dump($full_path); // → string(17) "/asd/asd/asd/asd/" Please wait a while before landing, so other people may leave a comment Comment Actions how about something like: public function getURI($to_path = '') { $base = coalesce($this->path(), ''); $to_path = coalesce($this_path, ''); $full_path = '/'; $full_path = rtrim($this->getPath(), '/').'/'.ltrim($to_path, '/'); Comment Actions Do you mean ? public function getURI($to_path = '') { $path = coalesce($this->path, ''); $to_path = coalesce($to_path, ''); $full_path = rtrim($path, '/').'/'.ltrim($to_path, '/'); Why not its more concise so easier to read (I wasn't aware of phorge's coalesce function). If everybody agree on that, I'll update the revision accordingly.
Comment Actions I was updating the diff when I saw below that function getWebsocketURI may also be affected by a NULL issue : public function getWebsocketURI($to_path = null) { $instance = PhabricatorEnv::getEnvConfig('cluster.instance'); if (strlen($instance)) { $to_path = $to_path.'~'.$instance.'/'; } $uri = $this->getURI($to_path); if ($this->getProtocol() == 'https') { $uri->setProtocol('wss'); } else { $uri->setProtocol('ws'); } return $uri; } I guess that the to_path argument should also be set by default to an empty string and verified against NULL value before being concatenated with another stuff isn't it ?
Comment Actions Thanks for the patch suggestion ! Then we can :
What is in your opinion the best option ? Comment Actions Yeah feel free to land this as-is, that was easy-peasy accepted So you have more commits and more glory |