Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exceptions which block rendering the Conduit page
ClosedPublic

Authored by aklapper on Apr 30 2023, 12:10.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 16, 21:44
Unknown Object (File)
Sun, Apr 7, 06:51
Unknown Object (File)
Sun, Mar 31, 03:09
Unknown Object (File)
Fri, Mar 29, 09:30
Unknown Object (File)
Wed, Mar 27, 18:05
Unknown Object (File)
Mar 21 2024, 03:46
Unknown Object (File)
Mar 20 2024, 14:53
Unknown Object (File)
Mar 10 2024, 01:36

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 T15307

Test Plan

Applied these two changes (on top D25144, D25145, D25146, D25147, D25150,
D25151, D25152, D25153, D25154 locally applied) and /conduit/ finally
rendered in web browser. Also the page /conduit/query/.

Diff Detail

Repository
rP Phorge
Branch
D25156 (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 304
Build 304: arc lint + arc unit

Event Timeline

valerio.bozzolan edited the test plan for this revision. (Show Details)
valerio.bozzolan added inline comments.
src/applications/conduit/query/PhabricatorConduitSearchEngine.php
42

✅ I logged the value of $contains in /conduit/query/ and its domain seems to be always NULL or a string. Alien values will be reported by phutil_nonempty_string() and that is OK.

src/view/phui/PHUIObjectItemView.php
877

✅ I logged the value of $label in 50+ pages and its domain seems to be always NULL or a string. Alien values will be reported by phutil_nonempty_string() and that is OK.

This revision is now accepted and ready to land.Apr 30 2023, 12:35

I forgot the meme while saying that it works for me in PHP 8.1 without explosions:

sgtm