xref: /PHP-7.3/ext/standard/tests/http/bug53198.phpt (revision 4b1dff6f)
1--TEST--
2Bug #53198 (From: header cannot be changed with ini_set)
3--SKIPIF--
4<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?>
5--INI--
6allow_url_fopen=1
7from=teste@teste.pt
8--FILE--
9<?php
10require 'server.inc';
11
12function do_test() {
13
14	$responses = array(
15		"data://text/plain,HTTP/1.0 200 OK\r\n\r\n",
16	);
17
18	$pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
19
20	foreach($responses as $r) {
21
22		$fd = fopen('http://127.0.0.1:12342/', 'rb', false);
23
24		fseek($output, 0, SEEK_SET);
25		var_dump(stream_get_contents($output));
26		fseek($output, 0, SEEK_SET);
27	}
28
29	http_server_kill($pid);
30
31}
32
33echo "-- Test: leave default --\n";
34
35do_test();
36
37echo "-- Test: after ini_set --\n";
38
39ini_set('from', 'junk@junk.com');
40
41do_test();
42
43?>
44--EXPECTF--
45-- Test: leave default --
46string(%d) "GET / HTTP/1.0
47From: teste@teste.pt
48Host: 127.0.0.1:12342
49Connection: close
50
51"
52-- Test: after ini_set --
53string(%d) "GET / HTTP/1.0
54From: junk@junk.com
55Host: 127.0.0.1:12342
56Connection: close
57
58"
59