1--TEST--
2FPM: FastCGI env var no path info fix for custom setup with PATH_INFO and PATH_TRANSLATED
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 = dynamic
16pm.max_children = 5
17pm.start_servers = 1
18pm.min_spare_servers = 1
19pm.max_spare_servers = 3
20php_admin_value[cgi.fix_pathinfo] = no
21php_admin_value[cgi.discard_path] = no
22EOT;
23
24$code = <<<EOT
25<?php
26echo \$_SERVER["SCRIPT_NAME"] . "\n";
27echo \$_SERVER["SCRIPT_FILENAME"] . "\n";
28echo \$_SERVER["PATH_INFO"] . "\n";
29echo \$_SERVER["PHP_SELF"];
30EOT;
31
32$tester = new FPM\Tester($cfg, $code);
33[$sourceFilePath, $scriptName] = $tester->createSourceFileAndScriptName();
34$tester->start();
35$tester->expectLogStartNotices();
36$tester
37    ->request(
38        headers: [
39            'PATH_INFO' => '/pinfo',
40            'PATH_TRANSLATED' => $sourceFilePath,
41        ],
42        uri: $scriptName . '/pinfo',
43        scriptFilename: $sourceFilePath . '/pinfo', // used just for variable display
44        scriptName: $scriptName,
45    )
46    ->expectBody([$scriptName, $sourceFilePath . '/pinfo', '/pinfo', '/pinfo']);
47$tester->terminate();
48$tester->close();
49
50?>
51Done
52--EXPECT--
53Done
54--CLEAN--
55<?php
56require_once "tester.inc";
57FPM\Tester::clean();
58?>
59