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.

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

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