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
F3763563: D25185.1745839349.diff
Sun, Apr 27, 11:22
F3763562: D25185.1745839348.diff
Sun, Apr 27, 11:22
F3741466: D25185.1745764372.diff
Sat, Apr 26, 14:32
F3738894: D25185.1745760754.diff
Sat, Apr 26, 13:32
F3645396: D25185.1745371993.diff
Tue, Apr 22, 01:33
F3604968: D25185.1745246851.diff
Sun, Apr 20, 14:47
F3430175: D25185.1744660584.diff
Sun, Apr 13, 19:56
F3429488: D25185.1744658074.diff
Sun, Apr 13, 19:14

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
Branch
createSpace (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 354
Build 354: arc lint + arc unit

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