Page MenuHomePhorge

Fix PHP 8.1 "preg_match(null)" exception for missing User-Agent HTTP Header
Needs ReviewPublic

Authored by aklapper on Mon, Feb 10, 19:30.
Tags
None
Referenced Files
F2991756: D25868.1740196729.diff
Fri, Feb 21, 03:58
F2988993: D25868.1740161904.diff
Thu, Feb 20, 18:18
F2988149: D25868.1740120751.diff
Thu, Feb 20, 06:52
F2985491: D25868.1740057376.diff
Wed, Feb 19, 13:16
F2982394: D25868.1739954733.diff
Tue, Feb 18, 08:45
F2979555: D25868.1739863298.diff
Mon, Feb 17, 07:21
F2979226: D25868.1739815878.diff
Sun, Feb 16, 18:11
F2977236: D25868.1739625230.diff
Fri, Feb 14, 13:13

Details

Summary

Passing null to preg_match() is deprecated behavior since PHP 8.1.
Some clients do not pass a User-Agent HTTP header so $agent is null.
Thus only call preg_match() when $agent is set.

ERROR 8192: preg_match(): preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated
#0 preg_match(string, NULL) called at [<phorge>/src/view/page/PhabricatorStandardPageView.php:629]

Closes T15829

Test Plan

Access a task page etc in a browser which does not set a User-Agent HTTP Header string.

Diff Detail

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