1--TEST--
2FPM: bug75712 - getenv should not read from $_ENV and $_SERVER
3--SKIPIF--
4<?php include "skipif.inc"; ?>
5--FILE--
6<?php
7
8require_once "tester.inc";
9
10$cfg = <<<EOT
11[global]
12error_log = {{FILE:LOG}}
13[unconfined]
14listen = {{ADDR}}
15pm = static
16pm.max_children = 1
17env[TEST] = test
18php_value[register_argc_argv] = on
19EOT;
20
21$code = <<<EOT
22<?php
23
24var_dump(isset(getenv()['argv']));
25var_dump(isset(getenv()['SERVER_NAME']));
26var_dump(getenv()['TEST']);
27var_dump(isset(getenv()['DTEST']));
28var_dump(getenv('DTEST'));
29putenv('DTEST=dt');
30var_dump(getenv()['DTEST']);
31var_dump(getenv('DTEST'));
32
33function notcalled()
34{
35    \$_SERVER['argv'];
36}
37EOT;
38
39$tester = new FPM\Tester($cfg, $code);
40$tester->start();
41$tester->expectLogStartNotices();
42$tester->request()->expectBody([
43    'bool(false)',
44    'bool(true)',
45    'string(4) "test"',
46    'bool(false)',
47    'bool(false)',
48    'string(2) "dt"',
49    'string(2) "dt"',
50]);
51$tester->terminate();
52$tester->close();
53
54?>
55Done
56--EXPECT--
57Done
58--CLEAN--
59<?php
60require_once "tester.inc";
61FPM\Tester::clean();
62?>
63