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.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 13, 15:34
Unknown Object (File)
Fri, Apr 12, 03:40
Unknown Object (File)
Wed, Apr 10, 23:30
Unknown Object (File)
Wed, Apr 10, 21:47
Unknown Object (File)
Sun, Apr 7, 05:31
Unknown Object (File)
Wed, Apr 3, 18:08
Unknown Object (File)
Mon, Apr 1, 01:33
Unknown Object (File)
Sun, Mar 31, 19:35

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