@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator

Fix PHP 8.1 "strlen(null)" exceptions which block adding Dashboard to Project Menu

Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior 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.

Closes T15339

Test Plan: Applied these four changes and `/dashboard/install/1/project/` finally rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15339

Differential Revision: https://we.phorge.it/D25184

+4 -4
+4 -4
src/applications/dashboard/install/PhabricatorDashboardObjectInstallWorkflow.php
··· 17 17 $target_identifier = head($target_tokens); 18 18 } 19 19 20 - if (!strlen($target_identifier)) { 20 + if (!phutil_nonempty_string($target_identifier)) { 21 21 $target_identifier = $request->getStr('target'); 22 22 } 23 23 24 - if (!strlen($target_identifier)) { 24 + if (!phutil_nonempty_string($target_identifier)) { 25 25 $target_identifier = $this->getMode(); 26 26 } 27 27 28 28 $target = null; 29 - if (strlen($target_identifier)) { 29 + if (phutil_nonempty_string($target_identifier)) { 30 30 $targets = array(); 31 31 32 32 if (ctype_digit($target_identifier)) { ··· 74 74 } 75 75 76 76 $errors = array(); 77 - if (strlen($target_identifier)) { 77 + if (phutil_nonempty_string($target_identifier)) { 78 78 if (!$target) { 79 79 $errors[] = pht('Choose a valid object.'); 80 80 } else if (!$can_edit) {