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.

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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

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

jackie_chan_wtf

OH NO

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

✅ 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.

156

✅ 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.

238

✅ 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