@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix PHP 8.1 "strlen(null)" exception rendering dashboard panel with latest tasks when custom text field configured

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.

```
EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
#0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldText.php:33]
```

Closes T15684

Test Plan: After configuring a custom `text` field and a dashboard panel to query and listed the latest created tasks, access the panel.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15684

Differential Revision: https://we.phorge.it/D25488

+2 -2
+2 -2
src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldText.php
··· 11 11 $indexes = array(); 12 12 13 13 $value = $this->getFieldValue(); 14 - if (strlen($value)) { 14 + if (phutil_nonempty_string($value)) { 15 15 $indexes[] = $this->newStringIndex($value); 16 16 } 17 17 ··· 30 30 PhabricatorCursorPagedPolicyAwareQuery $query, 31 31 $value) { 32 32 33 - if (strlen($value)) { 33 + if (phutil_nonempty_string($value)) { 34 34 $query->withApplicationSearchContainsConstraint( 35 35 $this->newStringIndex(null), 36 36 $value);