xref: /PHP-8.3/ext/standard/tests/http/gh9316.phpt (revision 72da4187)
1--TEST--
2Bug GH-9316 ($http_response_header is wrong for long status line)
3--SKIPIF--
4<?php require 'server.inc'; http_server_skipif(); ?>
5--INI--
6allow_url_fopen=1
7--FILE--
8<?php
9require '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
18for ($i = 0; $i < count($responses); ++$i) {
19    $f = @fopen($uri, "r");
20    var_dump($http_response_header);
21    fclose($f);
22}
23
24http_server_kill($pid);
25
26--EXPECT--
27array(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}
33array(2) {
34  [0]=>
35  string(13) "HTTP/1.1 200 "
36  [1]=>
37  string(12) "Good: Header"
38}
39