1--TEST--
2FPM: FastCGI env var path info fix for Apache handler using Unix Domain Socket
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:UDS}}
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["PHP_SELF"];
28EOT;
29
30$tester = new FPM\Tester($cfg, $code);
31[$sourceFilePath, $scriptName] = $tester->createSourceFileAndScriptName();
32$tester->start();
33$tester->expectLogStartNotices();
34$tester
35    ->request(
36        uri: $scriptName,
37        address: '{{ADDR:UDS}}',
38        scriptFilename: "proxy:fcgi://localhost" . $sourceFilePath,
39        scriptName: $scriptName,
40    )
41    ->expectBody([$scriptName, $sourceFilePath, $scriptName]);
42$tester->terminate();
43$tester->close();
44
45?>
46Done
47--EXPECT--
48Done
49--CLEAN--
50<?php
51require_once "tester.inc";
52FPM\Tester::clean();
53?>
54