Page MenuHomePhorge

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

Authored by aklapper on May 10 2023, 14:27.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 13, 20:26
Unknown Object (File)
Thu, Apr 11, 09:07
Unknown Object (File)
Thu, Apr 11, 08:50
Unknown Object (File)
Wed, Apr 10, 19:32
Unknown Object (File)
Sun, Apr 7, 10:00
Unknown Object (File)
Sat, Apr 6, 01:33
Unknown Object (File)
Mon, Apr 1, 01:37
Unknown Object (File)
Tue, Mar 26, 08:39

Details

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.

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

aklapper edited the test plan for this revision. (Show Details)

Thanks (again)

I tested this patch locally following the test plan. No implosions.

Also tested with various Typehead like Subscribers.

sgtm

src/applications/project/typeahead/PhabricatorProjectDatasource.php
86

✅ I verified that the above line just contains a string (or maybe null for some weird cases).

The function phutil_nonempty_string() will report alien types (like objects), and that is OK.

135

✅ Same as above

This revision is now accepted and ready to land.May 11 2023, 16:53

To other reviewers: the related lint errors will be fixed also thanks to aklapper: D25209