Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception for "/bin/herald rule" without parameter
ClosedPublic

Authored by aklapper on Apr 16 2024, 08:45.
Tags
None
Referenced Files
F3220981: D25585.1741813287.diff
Tue, Mar 11, 21:01
F3220980: D25585.1741813286.diff
Tue, Mar 11, 21:01
F3220978: D25585.1741813285.diff
Tue, Mar 11, 21:01
F3151930: D25585.1741226942.diff
Wed, Mar 5, 02:09
F3151929: D25585.1741226941.diff
Wed, Mar 5, 02:09
F3147894: D25585.1741216526.diff
Tue, Mar 4, 23:15
F3082845: D25585.1741072553.diff
Mon, Mar 3, 07:15
F2976247: D25585.1739586789.diff
Fri, Feb 14, 02:33

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.

ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/herald/management/HeraldRuleManagementWorkflow.php:36]
Test Plan

Run ../phorge/bin/herald rule: Get no strlen() error anymore but only expected output Usage Exception: Specify a rule to edit with "--rule <id|monogram>".

Diff Detail

Repository
rP Phorge
Branch
cliHeraldRuleStrlen (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 1177
Build 1177: arc lint + arc unit