Page MenuHomePhorge

Fix PHP 8.1 "preg_match(null)" exception for missing Content-Type
ClosedPublic

Authored by aklapper on May 10 2024, 10:04.
Tags
None
Referenced Files
F3216819: D25632.1741716470.diff
Mon, Mar 10, 18:07
F2996408: D25632.1740375222.diff
Sun, Feb 23, 05:33
F2994776: D25632.1740329034.diff
Sat, Feb 22, 16:43
F2991874: D25632.1740198547.diff
Fri, Feb 21, 04:29
F2991873: D25632.1740198546.diff
Fri, Feb 21, 04:29
F2990350: D25632.1740177329.diff
Thu, Feb 20, 22:35
F2982096: D25632.1739944768.diff
Tue, Feb 18, 05:59
F2979505: D25632.1739858047.diff
Mon, Feb 17, 05:54

Details

Summary

When the Content-Type HTTP header is empty or missing, null is passed to preg_match() which is deprecated behavior since PHP 8.1. Thus only call preg_match() when the value is set.

ERROR 8192: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [$HOME/arcanist/src/future/http/status/HTTPFutureHTTPResponseStatus.php:24]

Closes T15821

Test Plan

Visit something using HTTPFutureHTTPResponseStatus, like, a profile image. No crashes.

Diff Detail

Repository
rARC Arcanist
Branch
strlenT15821 (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 1247
Build 1247: arc lint + arc unit