Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception which blocks rendering Configuration's Settings page
ClosedPublic

Authored by aklapper on May 1 2023, 21:18.
Tags
None
Referenced Files
F3306602: D25171.1743130031.diff
Thu, Mar 27, 02:47
F3305230: D25171.1743112726.diff
Wed, Mar 26, 21:58
F3299399: D25171.1743020492.diff
Tue, Mar 25, 20:21
F3298923: D25171.1743012079.diff
Tue, Mar 25, 18:01
F3298479: D25171.1743003144.diff
Tue, Mar 25, 15:32
F3298034: D25171.1742995308.diff
Tue, Mar 25, 13:21
F3295040: D25171.1742949701.diff
Tue, Mar 25, 00:41
F3290913: D25171.1742875220.diff
Mon, Mar 24, 04:00

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 T15324

Test Plan

Applied this change and /config/settings/ 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 1 2023, 21:18
aklapper retitled this revision from Fix PHP 8.1 "strlen(null)" exception[s] which block rendering Configuration's Settings page to Fix PHP 8.1 "strlen(null)" exception which blocks rendering Configuration's Settings page.May 1 2023, 22:58

Tested locally following the test plan. No implosions. This Thanks!

yesyes

src/applications/config/controller/settings/PhabricatorConfigSettingsListController.php
10

✅ I tracked $filter with phlog() and it assumes values like "advanced" or "all" or null and it's not indented to assume other types. You can have a proof of that also looking at the below lines.

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

This revision is now accepted and ready to land.May 2 2023, 20:39