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
F2945377: D25185.1738313326.diff
Thu, Jan 30, 08:48
F2945225: D25185.1738301060.diff
Thu, Jan 30, 05:24
F2941269: D25185.1738106562.diff
Mon, Jan 27, 23:22
F2941231: D25185.1738104254.diff
Mon, Jan 27, 22:44
F2941229: D25185.1738104251.diff
Mon, Jan 27, 22:44
F2936731: D25185.1737938220.diff
Sun, Jan 26, 00:37
F2936694: D25185.1737935837.diff
Sat, Jan 25, 23:57
F2934409: D25185.1737786833.diff
Fri, Jan 24, 06:33

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