xref: /PHP-8.4/sapi/cgi/tests/010.phpt (revision cbd108ab)
1--TEST--
2Bug #45860 (header() function fails to correctly replace all Status lines)
3--SKIPIF--
4<?php include "skipif.inc"; ?>
5--FILE--
6<?php
7
8include "include.inc";
9
10$php = get_cgi_path();
11reset_env_vars();
12
13$f = tempnam(sys_get_temp_dir(), 'cgitest');
14
15putenv("TRANSLATED_PATH=".$f."/x");
16putenv("SCRIPT_FILENAME=".$f."/x");
17file_put_contents($f, '<?php
18header("HTTP/1.1 403 Forbidden");
19header("Status: 403 Also Forbidden");
20?>');
21
22echo (`$php -n $f`);
23
24file_put_contents($f, '<?php
25header("HTTP/1.1 403 Forbidden");
26?>');
27
28echo (`$php -n $f`);
29
30file_put_contents($f, '<?php
31header("Status: 403 Also Forbidden");
32?>');
33
34echo (`$php -n $f`);
35
36echo "Done\n";
37
38@unlink($f);
39?>
40--EXPECTF--
41Status: 403 Forbidden
42X-Powered-By: PHP/%s
43Content-type: text/html; charset=UTF-8
44
45Status: 403 Forbidden
46X-Powered-By: PHP/%s
47Content-type: text/html; charset=UTF-8
48
49X-Powered-By: PHP/%s
50Status: 403 Also Forbidden
51Content-type: text/html; charset=UTF-8
52
53Done
54