Page MenuHomePhorge

Fix some PHP 8.1 "strlen(null)" exceptions which block rendering a project page
ClosedPublic

Authored by aklapper on Apr 30 2023, 18:40.
Tags
None
Referenced Files
F2164701: D25163.id610.diff
Thu, Apr 25, 16:54
F2164700: D25163.id585.diff
Thu, Apr 25, 16:54
F2164699: D25163.id.diff
Thu, Apr 25, 16:54
F2163551: D25163.id585.diff
Thu, Apr 25, 13:34
F2163549: D25163.id610.diff
Thu, Apr 25, 13:34
F2163503: D25163.id.diff
Thu, Apr 25, 13:12
F2163495: D25163.diff
Thu, Apr 25, 13:04
F2158041: D25163.diff
Thu, Apr 25, 04:18

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 T15313

Test Plan

Applied these three changes (with D25144, D25145, D25146, D25147, D25151,
D25152, D25153 on top).
Afterwards end up with the unresolved exception covered by T15263.

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Thanks again

Tested locally. No implosions.

sgtm

src/applications/project/state/PhabricatorWorkboardViewState.php
44

✅ I tested this locally with phlog() and $request->getURIData('queryKey') assumes values like "all" or other strings, or null.

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

172

✅ I tested this locally with phlog() and $request_query assumes values like "EoH3rp0DnRFW" or other search keys, or null.

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

206

✅ I tested this locally with phlog() and $default_query assumes values like "all" or other strings, or null.

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

This revision is now accepted and ready to land.May 1 2023, 20:21