1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-19 16:58:48 +02:00

Fix a PHP 8.1 deprecated use of strlen with a NULL argument

Summary:
This strlen() call was preventing a new Phorge instance to be deployed/configured.
Indeed, on a fresh instance, configuration's "base-uri" key may not be defined witch lead to a Runtime Exception.
Using strlen() to check string validity is deprecated since PHP 8.1, phorge adopts phutil_nonempty_string() as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

Fix T15605

Test Plan:
- Checkout a fresh Phorge local copy from official 'https://we.phorge.it/source/phorge.git'
- Install/Configure local webserver/database
- Open http://phorge.domain in you browser
- Configure Phorge database (as requested by webpage)
- Create Phorge database (as requested by webpage)
- You should be able to reach administrator account page instead of getting a RuntimeException

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15605

Differential Revision: https://we.phorge.it/D25394
This commit is contained in:
bob 2023-08-18 09:20:23 +02:00
parent 7f46a252f2
commit 0ef08baf64

View file

@ -23,7 +23,7 @@ final class PhabricatorWebServerSetupCheck extends PhabricatorSetupCheck {
}
$base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri');
if (!strlen($base_uri)) {
if (!$base_uri) {
// If `phabricator.base-uri` is not set then we can't really do
// anything.
return;