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
Unknown Object (File)
Wed, May 15, 01:26
Unknown Object (File)
Sat, May 4, 12:31
Unknown Object (File)
Mon, Apr 29, 00:18
Unknown Object (File)
Sat, Apr 27, 16:46
Unknown Object (File)
Wed, Apr 24, 22:46
Unknown Object (File)
Apr 17 2024, 18:16
Unknown Object (File)
Apr 17 2024, 06:38
Unknown Object (File)
Apr 12 2024, 08:19

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
Branch
ExceptionCustomTextField (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 968
Build 968: arc lint + arc unit

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