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
F3176219: D25487.1741298055.diff
Wed, Mar 5, 21:54
F3171629: D25487.1741276275.diff
Wed, Mar 5, 15:51
F3020257: D25487.1740783854.diff
Thu, Feb 27, 23:04
F3001412: D25487.1740442102.diff
Mon, Feb 24, 00:08
F3001410: D25487.1740442100.diff
Mon, Feb 24, 00:08
F2987185: D25487.1740110738.diff
Thu, Feb 20, 04:05
F2982297: D25487.1739948812.diff
Tue, Feb 18, 07:06
F2977175: D25487.1739618419.diff
Fri, Feb 14, 11:20

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