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)
Thu, May 9, 02:45
Unknown Object (File)
Thu, May 9, 02:30
Unknown Object (File)
Fri, May 3, 04:54
Unknown Object (File)
Fri, May 3, 03:12
Unknown Object (File)
Thu, May 2, 16:21
Unknown Object (File)
Wed, May 1, 12:42
Unknown Object (File)
Wed, May 1, 12:42
Unknown Object (File)
Wed, May 1, 12:42

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