Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception in PHPASTParserTestCase
ClosedPublic

Authored by aklapper on Aug 23 2024, 11:08.
Tags
None
Referenced Files
F2938952: D25800.1738026821.diff
Mon, Jan 27, 01:13
F2938950: D25800.1738026820.diff
Mon, Jan 27, 01:13
F2938849: D25800.1738024792.diff
Mon, Jan 27, 00:39
F2932350: D25800.1737733249.diff
Thu, Jan 23, 15:40
F2889036: D25800.1737198485.diff
Fri, Jan 17, 11:08
F2871132: D25800.1736838262.diff
Mon, Jan 13, 07:04
F2870118: D25800.1736771164.diff
Sun, Jan 12, 12:26
F2869421: D25800.1736704545.diff
Sat, Jan 11, 17:55

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/arcanist/src/parser/xhpast/__tests__/PHPASTParserTestCase.php:85]

Refs T15926

Test Plan

Either read the code, or probably run something like arc unit on D25797?

Diff Detail

Repository
rARC Arcanist
Branch
strlenPHPASTParserTestCase
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 1559
Build 1559: arc lint + arc unit