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
F3338208: D25487.1743600954.diff
Tue, Apr 1, 13:35
F3334922: D25487.1743555611.diff
Tue, Apr 1, 01:00
F3331237: D25487.1743503941.diff
Mon, Mar 31, 10:39
F3330913: D25487.1743497236.diff
Mon, Mar 31, 08:47
F3330362: D25487.1743487823.diff
Mon, Mar 31, 06:10
F3327534: D25487.1743441214.diff
Sun, Mar 30, 17:13
F3311558: D25487.1743205762.diff
Thu, Mar 27, 23:49
F3306359: D25487.1743127448.diff
Thu, Mar 27, 02:04

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