1--TEST--
2FPM: FastCGI env var path info fix for Apache ProxyPass SCRIPT_NAME stripping with encoded path (bug #74129)
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["ORIG_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        uri: $scriptName . '/1%202',
39        scriptFilename: "proxy:fcgi://" . $tester->getAddr() . $sourceFilePath . '/1%202',
40        scriptName: $scriptName . '/1 2'
41    )
42    ->expectBody([$scriptName, $scriptName . '/1 2', $sourceFilePath, '/1%202', $scriptName . '/1%202']);
43$tester->terminate();
44$tester->close();
45
46?>
47Done
48--EXPECT--
49Done
50--CLEAN--
51<?php
52require_once "tester.inc";
53FPM\Tester::clean();
54?>
55