HomePhorge

Fix PHP 8.1 "strlen(null)" exception when Diffusion repository has no tags

Description

Fix PHP 8.1 "strlen(null)" exception when Diffusion repository has no tags

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=diffusionEmptyRepoPatternSearch, ref.master=97e163187418, ref.diffusionEmptyRepoPatternSearch=97e163187418), phorge(head=master, ref.master=108cbcd09bd3)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/diffusion/controller/DiffusionTagListController.php:28]

Closes T15461

Test Plan: After applying this line, get the expected CommandException: Command failed with error #128! due to fatal: detected dubious ownership in repository at '/var/repo/1' (plus a RuntimeException: file_exists(): Passing null to parameter #1 ($filename) of type string is deprecated as a bonus), instead of the previous RuntimeException about strlen().

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15461

Differential Revision: https://we.phorge.it/D25285

Details

Provenance
Andre KlapperAuthored on Jun 12 2023, 12:50 PM
themackabuPushed on Mar 25 2025, 8:07 PM
Parents
rP54ee51d7abd0: Work around exception in Herald transcript of old tasks: Call to a member…
Branches
Unknown
Tags
Unknown

Event Timeline