Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception which blocks rendering a project's page when Reports prototype enabled
ClosedPublic

Authored by aklapper on May 6 2023, 13:33.

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.

This is exactly the same case as D25140.

Closes T15360

Test Plan

Applied this change and /project/view/1/ rendered the workboard in the web browser as expected.

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

aklapper requested review of this revision.May 6 2023, 13:33
aklapper retitled this revision from Fix PHP 8.1 "strlen(null)" exception[s] which block rendering the XXXX page to Fix PHP 8.1 "strlen(null)" exception which blocks rendering a project's page when Reports prototype enabled.May 6 2023, 13:34

Thanks for this patch

I tested this locally logging $name and I confirm the bind between that and the menu name, that so it's a string or null (default).

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

The lint errors are TOTALLY UNRELATED and related to T15334: PhabricatorProjectCoreTestCase: fix "Implicit conversion from float "

This revision is now accepted and ready to land.May 8 2023, 11:51