Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception adding "Build with Buildkite" build step in Harbormaster
ClosedPublic

Authored by aklapper on Aug 6 2023, 21:08.
Tags
None
Referenced Files
F3284024: D25379.1742764984.diff
Sat, Mar 22, 21:23
F3253146: D25379.1742422682.diff
Tue, Mar 18, 22:18
F3250991: D25379.1742333264.diff
Mon, Mar 17, 21:27
F3250575: D25379.1742304998.diff
Mon, Mar 17, 13:36
F3225051: D25379.1742090303.diff
Sat, Mar 15, 01:58
F3223679: D25379.1742006166.diff
Fri, Mar 14, 02:36
F3223638: D25379.1741993755.diff
Thu, Mar 13, 23:09
F3220736: D25379.1741813081.diff
Tue, Mar 11, 20:58

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.

EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=customOAuthUrlencodeNull, ref.master=788098096e11, ref.customOAuthUrlencodeNull=4f0f2043b7e9), phorge(head=master, ref.master=226f3150933d)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php:271]

Closes T15594

Test Plan

Add a build step in Harbormaster, select "Interacting with External Build Systems > Build with Buildkite" at /harbormaster/step/new/1/HarbormasterBuildkiteBuildStepImplementation/, select the "Create Build Step" button. Page now shows several expected error messages (API Token is required; Organization Name is required; etc) instead of a PHP error.

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable