Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception which blocks rendering Config's Database Status page
ClosedPublic

Authored by aklapper on May 29 2023, 17:45.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 16, 12:40
Unknown Object (File)
Sun, Apr 7, 06:25
Unknown Object (File)
Mon, Apr 1, 01:53
Unknown Object (File)
Sun, Mar 31, 03:10
Unknown Object (File)
Sat, Mar 30, 09:56
Unknown Object (File)
Sat, Mar 30, 05:45
Unknown Object (File)
Wed, Mar 27, 17:01
Unknown Object (File)
Feb 25 2024, 07:39

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 T15428

Test Plan

Applied this change; afterwards displays "Database Status" page at /config/database/ correctly rendered in web browser.

Also visit every single database name, to see that also there nothing explode.

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Thanks, again! :)

I verified this patch locally with MariaDB

The $property just assumes values like null or strings like "phabricator_user" or "phabricator_legalpad" etc.

The function phutil_nonempty_string() will explode with any alien type, and that is OK here.

I've opened all the single pages, one per database, (more than 60 databases) without any crash.

sgtm

This revision is now accepted and ready to land.May 29 2023, 19:11