Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception which blocks rendering "Browse Dashboards" dialog

Authored by aklapper on Sat, May 13, 11:24.
Referenced Files
Unknown Object (File)
Wed, May 31, 16:39
Unknown Object (File)
Wed, May 31, 06:45
Unknown Object (File)
Tue, May 30, 21:29
Unknown Object (File)
Tue, May 30, 03:16
Unknown Object (File)
Mon, May 29, 19:09
Unknown Object (File)
Thu, May 25, 19:53



strlen() was used in Phabricator to check if a generic value is a non-empty string.

But, that function does not accept null anymore since PHP 8.1.

Closes T15396

Test Plan

Applied this change (on top of D25179 and D25226) and the "Browse Dashboards" dialog got rendered in web browser.

Diff Detail

rP Phorge
Lint Not Applicable
Tests Not Applicable

Event Timeline

valerio.bozzolan added inline comments.

Wow, finally a place where strlen() was really needed!

Please just do something like this before the strlen:

if($query === null) {
  $query = '';
This revision now requires changes to proceed.Sat, May 13, 22:54

Uh, that unit test was useful indeed, and I know understand the rest of the code.

Thanks for your update

I tested this locally without any implosion even if I was honestly not able to reproduce a null case while visiting the /dashboard/ page. Anyway, this is 100% legit to me.



This revision is now accepted and ready to land.Fri, May 19, 08:54