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
F2054354: D25171.diff
Wed, Mar 27, 17:32
Unknown Object (File)
Feb 25 2024, 07:36
Unknown Object (File)
Feb 25 2024, 07:36
Unknown Object (File)
Feb 25 2024, 06:54
Unknown Object (File)
Feb 25 2024, 06:47
Unknown Object (File)
Feb 17 2024, 12:38
Unknown Object (File)
Feb 17 2024, 12:21
Unknown Object (File)
Feb 17 2024, 12:21

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

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