@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 exceptions rendering task when custom select 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.

In the other case, do not call `json_decode()` when passing null to it.

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

```
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/PhabricatorStandardCustomFieldSelect.php:76]
```

Closes T15683

Test Plan: After configuring a custom `select` field, access a task.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15683

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

+2 -2
+1 -1
src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php
··· 40 40 // TODO: Clean this up. 41 41 42 42 $result = array(); 43 - if (!is_array($value)) { 43 + if (!is_array($value) && phutil_nonempty_string($value)) { 44 44 $value = json_decode($value, true); 45 45 if (is_array($value)) { 46 46 $result = array_values($value);
+1 -1
src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldSelect.php
··· 73 73 } 74 74 75 75 public function renderPropertyViewValue(array $handles) { 76 - if (!strlen($this->getFieldValue())) { 76 + if (!phutil_nonempty_string($this->getFieldValue())) { 77 77 return null; 78 78 } 79 79 return idx($this->getOptions(), $this->getFieldValue());