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)
Tue, May 21, 00:53
Unknown Object (File)
Sun, May 19, 00:40
Unknown Object (File)
Mon, May 6, 00:49
Unknown Object (File)
Sat, May 4, 05:24
Unknown Object (File)
Wed, May 1, 21:29
Unknown Object (File)
Wed, May 1, 21:29
Unknown Object (File)
Wed, May 1, 21:29
Unknown Object (File)
Mon, Apr 29, 19:47

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