Page MenuHomePhorge

Fix PHP 8.1 exceptions rendering task when custom select field configured
ClosedPublic

Authored by aklapper on Dec 5 2023, 03:03.
Tags
None
Referenced Files
F3311558: D25487.1743205762.diff
Thu, Mar 27, 23:49
F3306359: D25487.1743127448.diff
Thu, Mar 27, 02:04
F3304765: D25487.1743104541.diff
Wed, Mar 26, 19:42
F3304277: D25487.1743095292.diff
Wed, Mar 26, 17:08
F3299681: D25487.1743026257.diff
Tue, Mar 25, 21:57
F3298906: D25487.1743011075.diff
Tue, Mar 25, 17:44
F3249321: D25487.1742285658.diff
Mon, Mar 17, 08:14
F3225863: D25487.1742144727.diff
Sat, Mar 15, 17:05

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.

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.

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

aklapper requested review of this revision.Dec 5 2023, 03:03
aklapper retitled this revision from Fix PHP 8.1 exceptions rendering task when custom text field configured to Fix PHP 8.1 exceptions rendering task when custom select field configured.Dec 5 2023, 03:06
aklapper edited the test plan for this revision. (Show Details)
This revision is now accepted and ready to land.Dec 5 2023, 12:03