Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception which blocks loading icons when creating new Diffusion repository
ClosedPublic

Authored by aklapper on Apr 30 2023, 08:38.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 11, 12:02
Unknown Object (File)
Thu, Apr 11, 03:20
Unknown Object (File)
Wed, Apr 10, 23:01
Unknown Object (File)
Mon, Apr 8, 08:16
Unknown Object (File)
Mon, Apr 1, 00:41
Unknown Object (File)
Sun, Mar 31, 12:33
Unknown Object (File)
Sun, Mar 31, 12:33
Unknown Object (File)
Sat, Mar 30, 15:31

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 T15301

Test Plan

Applied this change (on top of D25150) and icons rendered in web browser.

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Thanks for this fix

Tested locally with / without HTTP Range playing an audio file.

sgtm

src/applications/files/controller/PhabricatorFileDataController.php
72

✅ The HTTP range assumes string values like "bytes=0-" etc. and null but not other things.

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

This revision is now accepted and ready to land.May 1 2023, 18:47