xref: /PHP-8.0/ext/standard/tests/http/bug53198.phpt (revision 95f25837)
1--TEST--
2Bug #53198 (From: header cannot be changed with ini_set)
3--SKIPIF--
4<?php require 'server.inc'; http_server_skipif(); ?>
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.1 200 OK\r\n\r\n",
16    );
17
18    ['pid' => $pid, 'uri' => $uri] = http_server($responses, $output);
19
20    foreach($responses as $r) {
21
22        $fd = fopen($uri, '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.1
47From: teste@teste.pt
48Host: %s:%d
49Connection: close
50
51"
52-- Test: after ini_set --
53string(%d) "GET / HTTP/1.1
54From: junk@junk.com
55Host: %s:%d
56Connection: close
57
58"
59