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
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
F2963965: D25487.1739263774.diff
Mon, Feb 10, 08:49
F2961501: D25487.1739163626.diff
Sun, Feb 9, 05:00
F2945893: D25487.1738371533.diff
Fri, Jan 31, 00:58
F2944094: D25487.1738244164.diff
Wed, Jan 29, 13:36
F2919193: D25487.1737533877.diff
Jan 21 2025, 08:17

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