Page MenuHomePhorge

Fix PHP 8.1 "preg_match(null)" exception in XHPASTNode
ClosedPublic

Authored by aklapper on Aug 23 2024, 11:14.
Tags
None
Referenced Files
F3033439: D25801.1740882904.diff
Sat, Mar 1, 02:35
F3001549: D25801.1740443464.diff
Mon, Feb 24, 00:31
F3001548: D25801.1740443462.diff
Mon, Feb 24, 00:31
F2994680: D25801.1740324908.diff
Sat, Feb 22, 15:35
F2992586: D25801.1740230575.diff
Fri, Feb 21, 13:22
F2951148: D25801.1738874053.diff
Wed, Feb 5, 20:34
F2940277: D25801.1738048510.diff
Jan 27 2025, 07:15
F2938956: D25801.1738026826.diff
Jan 27 2025, 01:13

Details

Summary

When $u is null, null is passed to preg_match() which is deprecated behavior since PHP 8.1.
Thus first check if $u === null.

ERROR 8192: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [/var/www/html/phorge/arcanist/src/parser/xhpast/api/XHPASTNode.php:243]

Refs T15926

Test Plan

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

Diff Detail

Repository
rARC Arcanist
Branch
pregmatchXHPASTNode
Lint
Lint Passed
Unit
Test Failures
Build Status
Buildable 1560
Build 1560: arc lint + arc unit

Unit TestsFailed

TimeTest
662 msArcanistBundleTestCase::testGitRepository
EXCEPTION (Exception): Expected patch and actual patch for 5dec8bf28557f078d1987c4e8cfb53d08310f522 differ. Wrote actual patch to '/var/www/html/phorge/arcanist/src/parser/__tests__/patches//5dec8bf28557f078d1987c4e8cfb53d08310f522.gitpatch.real'. #0 /var/www/html/phorge/arcanist/src/parser/__tests__/ArcanistBundleTestCase.php(85): ArcanistBundleTestCase->runGitRepositoryTests(Object(PhutilDirectoryFixture)) #1 /var/www/html/phorge/arcanist/src/unit/engine/phutil/PhutilTestCase.php(634): ArcanistBundleTestCase->testGitRepository()
45 msArcanistBaseCommitParserTestCase::testBasics
2 assertion(s) passed.
48 msArcanistBaseCommitParserTestCase::testHalt
1 assertion(s) passed.
43 msArcanistBaseCommitParserTestCase::testJump
1 assertion(s) passed.
47 msArcanistBaseCommitParserTestCase::testJumpReturn
1 assertion(s) passed.
View Full Test Results (1 Failed · 78 Passed)