1--TEST--
2FPM: FastCGI env var path info fix for Apache handler with PATH_INFO set
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] = yes
21EOT;
22
23$code = <<<EOT
24<?php
25echo \$_SERVER["SCRIPT_NAME"] . "\n";
26echo \$_SERVER["SCRIPT_FILENAME"] . "\n";
27echo \$_SERVER["PATH_INFO"] . "\n";
28echo \$_SERVER["PHP_SELF"];
29EOT;
30
31$tester = new FPM\Tester($cfg, $code);
32[$sourceFilePath, $scriptName] = $tester->createSourceFileAndScriptName();
33$tester->start();
34$tester->expectLogStartNotices();
35$tester
36    ->request(
37        headers: [
38            'PATH_INFO' => '/pinfo',
39            'PATH_TRANSLATED' => __DIR__ . '/pinfo',
40        ],
41        uri: $scriptName . '/pinfo',
42        scriptFilename: "proxy:fcgi://" . $tester->getAddr() . $sourceFilePath,
43        scriptName: $scriptName,
44    )
45    ->expectBody([$scriptName, $sourceFilePath, '/pinfo', $scriptName . '/pinfo']);
46$tester->terminate();
47$tester->close();
48
49?>
50Done
51--EXPECT--
52Done
53--CLEAN--
54<?php
55require_once "tester.inc";
56FPM\Tester::clean();
57?>
58