Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception which blocks Space creation
ClosedPublic

Authored by aklapper on May 4 2023, 11:29.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 17, 02:57
Unknown Object (File)
Sun, Apr 14, 00:38
Unknown Object (File)
Sun, Apr 14, 00:32
Unknown Object (File)
Fri, Apr 12, 05:06
Unknown Object (File)
Thu, Apr 11, 15:14
Unknown Object (File)
Thu, Apr 11, 05:58
Unknown Object (File)
Tue, Apr 9, 10:06
Unknown Object (File)
Mon, Apr 1, 00:54

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 T15340

Test Plan

Applied this change and page /S3 rendered in web browser.

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

aklapper requested review of this revision.May 4 2023, 11:29

Thanks for this patch, again

I tested this patch locally. I was able to create a Space, rename a Space, etc., without any nuclear implosion.

Thanks

Green light

yesyes

src/applications/spaces/xaction/PhabricatorSpacesNamespaceNameTransaction.php
18

✅ The value $old always is NULL at startup, or is a string after a rename.

The function phutil_nonempty_string() will report any alien type, and that is OK.

This revision is now accepted and ready to land.May 5 2023, 19:54