1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 06:42:42 +01:00

Fix PHP 8.1 exception creating 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.

```
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:14]
```

Closes T15691

Test Plan: After configuring a custom `select` field, try to create a task via a Maniphest form using that custom field.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15691

Differential Revision: https://we.phorge.it/D25494
This commit is contained in:
Andre Klapper 2023-12-19 00:22:09 +01:00
parent 40d10fbe1a
commit 8e09dbfee3

View file

@ -11,7 +11,7 @@ final class PhabricatorStandardCustomFieldSelect
$indexes = array();
$value = $this->getFieldValue();
if (strlen($value)) {
if (($value !== null) && (strlen($value))) {
$indexes[] = $this->newStringIndex($value);
}