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.

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