Skip to content

Commit 2fa9ebe

Browse files
committed
Add test case
1 parent ae1db2c commit 2fa9ebe

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

ext/standard/tests/http/gh9316.phpt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
--TEST--
2+
Bug GH-9316 ($http_response_header is wrong for long status line)
3+
--SKIPIF--
4+
<?php require 'server.inc'; http_server_skipif(); ?>
5+
--INI--
6+
allow_url_fopen=1
7+
--FILE--
8+
<?php
9+
require 'server.inc';
10+
11+
$responses = array(
12+
"data://text/plain,HTTP/1.1 200 Some very long reason-phrase to test that this is properly handled by our code without adding a new header like Bad: Header\r\nGood: Header\r\n\r\nBody",
13+
"data://text/plain,HTTP/1.1 200\r\nGood: Header\r\n\r\nBody",
14+
);
15+
16+
['pid' => $pid, 'uri' => $uri] = http_server($responses, $output);
17+
18+
for ($i = 0; $i < count($responses); ++$i) {
19+
$f = @fopen($uri, "r");
20+
var_dump($http_response_header);
21+
fclose($f);
22+
}
23+
24+
http_server_kill($pid);
25+
26+
--EXPECT--
27+
array(2) {
28+
[0]=>
29+
string(126) "HTTP/1.1 200 Some very long reason-phrase to test that this is properly handled by our code without adding a new header like "
30+
[1]=>
31+
string(12) "Good: Header"
32+
}
33+
array(2) {
34+
[0]=>
35+
string(12) "HTTP/1.1 200"
36+
[1]=>
37+
string(12) "Good: Header"
38+
}

0 commit comments

Comments
 (0)