mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-21 22:32:41 +01:00
Fix PHP 8.1 "strlen(null)" exception rendering Task with empty custom date field
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] arcanist(head=customOAuthUrlencodeNull, ref.master=df6c315ace5f, ref.customOAuthUrlencodeNull=c69b9749027f), phorge(head=master, ref.master=7868ab3754fa) #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php:14] ``` Closes T15632 Test Plan: Have a custom field with type=date defined in maniphest.custom-field-definitions and edit an existing Task changing something else, keeping that field as empty. Reviewers: O1 Blessed Committers, Sten, valerio.bozzolan Reviewed By: O1 Blessed Committers, Sten, valerio.bozzolan Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15632 Differential Revision: https://we.phorge.it/D25431
This commit is contained in:
parent
f7d9d95b79
commit
a65061ddc3
1 changed files with 1 additions and 1 deletions
|
@ -11,7 +11,7 @@ final class PhabricatorStandardCustomFieldDate
|
|||
$indexes = array();
|
||||
|
||||
$value = $this->getFieldValue();
|
||||
if (strlen($value)) {
|
||||
if (phutil_nonempty_scalar($value)) {
|
||||
$indexes[] = $this->newNumericIndex((int)$value);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue