Skip to content

Commit e5e664b

Browse files
committed
Fix regex to properly validate HTTP status line format
Changed the regex in CreateResponse to ensure it matches only status lines starting at the beginning of the string. This prevents potential misinterpretation of malformed input and improves overall response handling accuracy.
1 parent 963af20 commit e5e664b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Http/CreateResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ private function getCode(string $status): int
7171
return 500;
7272
}
7373

74-
if (preg_match('/HTTP\/\d\.\d\s+(\d{3})/', $status, $match)) {
74+
if (preg_match('/^HTTP\/\d\.\d\s+(\d{3})/', $status, $match)) {
7575
return (int) $match[1];
7676
}
7777

0 commit comments

Comments
 (0)