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
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
F3220711: D25171.1741813053.diff
Tue, Mar 11, 20:57
F2983863: D25171.1740001955.diff
Feb 18 2025, 21:52
F2983862: D25171.1740001954.diff
Feb 18 2025, 21:52
F2983771: D25171.1740000126.diff
Feb 18 2025, 21:22

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