Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exceptions which block rendering the Conpherence page
ClosedPublic

Authored by aklapper on Apr 30 2023, 11:30.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 22, 08:01
Unknown Object (File)
Sun, Apr 21, 19:45
Unknown Object (File)
Sun, Apr 21, 18:03
Unknown Object (File)
Sun, Apr 21, 13:13
Unknown Object (File)
Fri, Apr 12, 18:54
Unknown Object (File)
Thu, Apr 11, 06:51
Unknown Object (File)
Sun, Apr 7, 12:03
Unknown Object (File)
Mon, Apr 1, 01:22

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 T15304

Test Plan

Applied these four changes (on top of D25144, D25145, D25146, D25147, D25150,
D25151, D25152, D25153) and /conpherence/ page finally rendered in web browser.

Diff Detail

Repository
rP Phorge
Branch
D25154 (branched from master)
Lint
Lint Warnings
SeverityLocationCodeMessage
Warningsrc/applications/conpherence/query/ConpherenceThreadQuery.php:138TXT3Line Too Long
Unit
Tests Passed
Build Status
Buildable 300
Build 300: arc lint + arc unit

Event Timeline

src/applications/conpherence/query/ConpherenceThreadQuery.php
138

jackie_chan_wtf

OH NO

src/applications/conpherence/query/ConpherenceThreadQuery.php
138

✅ I logged this locally and it seems this is just the user query for fulltext search, and its input domain is just NULL or string. The phutil_nonempty_string() will report alien values and this is OK.

155

✅ I logged this locally and it seems this is just the user query for fulltext search, and its input domain is just NULL or string. The phutil_nonempty_string() will report alien values and this is OK.

237

✅ I logged this locally and it seems this is just the user query for fulltext search, and its input domain is just NULL or string. The phutil_nonempty_string() will report alien values and this is OK.

src/applications/conpherence/query/ConpherenceThreadSearchEngine.php
109

✅ I logged this locally and it seems this is just the user query for fulltext search, and its input domain is just NULL or string. The phutil_nonempty_string() will report alien values and this is OK.

make linter happy about line longer than 80 characters

I tested this locally without any explosion related to alien checks of phutil_nonempty_string(). I was able to use Conpherence, search stuff, search full text, etc. Thanks

yesyes

This revision is now accepted and ready to land.Apr 30 2023, 15:40

Ah @aklapper please sign L1 Phorge Vision Statement - otherwise this installation will auto-destroy in 420 seconds