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

Fix PHP 8.1 "strlen(null)" exception[s] which block rendering "Browse Projects" overlay dialog

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 T15380

Test Plan: Applied these two changes (on top of D25179) and on the task creation page, after clicking the magnifier icon in the "Tags" field, the "Browse Projects" overlay dialog got rendered.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15380

Differential Revision: https://we.phorge.it/D25213
This commit is contained in:
Andre Klapper 2023-05-12 11:59:38 +02:00
parent c2856b479f
commit bac87ca264

View file

@ -83,7 +83,7 @@ final class PhabricatorProjectDatasource
}
$slug = $proj->getPrimarySlug();
if (!strlen($slug)) {
if (!phutil_nonempty_string($slug)) {
foreach ($proj->getSlugs() as $slug_object) {
$slug = $slug_object->getSlug();
if (strlen($slug)) {
@ -132,7 +132,7 @@ final class PhabricatorProjectDatasource
->setPriorityType('proj')
->setClosed($closed);
if (strlen($slug)) {
if (phutil_nonempty_string($slug)) {
$proj_result->setAutocomplete('#'.$slug);
}