mirror of
https://github.com/php/php-src.git
synced 2024-11-27 03:44:07 +08:00
Test FPM FCGI envs without path info fix for custom source
This commit is contained in:
parent
3125155b5d
commit
92d2cd5cb8
58
sapi/fpm/tests/fcgi-env-nopif-custom-with-pi-with-pt-pd.phpt
Normal file
58
sapi/fpm/tests/fcgi-env-nopif-custom-with-pi-with-pt-pd.phpt
Normal file
@ -0,0 +1,58 @@
|
||||
--TEST--
|
||||
FPM: FastCGI env var no path info fix for custom setup with PATH_INFO, PATH_TRANSLATED and path discard
|
||||
--SKIPIF--
|
||||
<?php include "skipif.inc"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once "tester.inc";
|
||||
|
||||
$cfg = <<<EOT
|
||||
[global]
|
||||
error_log = {{FILE:LOG}}
|
||||
[unconfined]
|
||||
listen = {{ADDR}}
|
||||
pm = dynamic
|
||||
pm.max_children = 5
|
||||
pm.start_servers = 1
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 3
|
||||
php_admin_value[cgi.fix_pathinfo] = no
|
||||
php_admin_value[cgi.discard_path] = yes
|
||||
EOT;
|
||||
|
||||
$code = <<<EOT
|
||||
<?php
|
||||
echo \$_SERVER["SCRIPT_NAME"] . "\n";
|
||||
echo \$_SERVER["SCRIPT_FILENAME"] . "\n";
|
||||
echo \$_SERVER["PATH_INFO"] . "\n";
|
||||
echo \$_SERVER["PHP_SELF"];
|
||||
EOT;
|
||||
|
||||
$tester = new FPM\Tester($cfg, $code);
|
||||
[$sourceFilePath, $scriptName] = $tester->createSourceFileAndScriptName();
|
||||
$tester->start();
|
||||
$tester->expectLogStartNotices();
|
||||
$tester
|
||||
->request(
|
||||
headers: [
|
||||
'PATH_INFO' => '/pinfo',
|
||||
'PATH_TRANSLATED' => __DIR__,
|
||||
],
|
||||
uri: $scriptName . '/pinfo',
|
||||
scriptFilename: $sourceFilePath,
|
||||
scriptName: $scriptName,
|
||||
)
|
||||
->expectBody([$scriptName, $sourceFilePath, '/pinfo', '/pinfo']);
|
||||
$tester->terminate();
|
||||
$tester->close();
|
||||
|
||||
?>
|
||||
Done
|
||||
--EXPECT--
|
||||
Done
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "tester.inc";
|
||||
FPM\Tester::clean();
|
||||
?>
|
58
sapi/fpm/tests/fcgi-env-nopif-custom-with-pi-with-pt.phpt
Normal file
58
sapi/fpm/tests/fcgi-env-nopif-custom-with-pi-with-pt.phpt
Normal file
@ -0,0 +1,58 @@
|
||||
--TEST--
|
||||
FPM: FastCGI env var no path info fix for custom setup with PATH_INFO and PATH_TRANSLATED
|
||||
--SKIPIF--
|
||||
<?php include "skipif.inc"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once "tester.inc";
|
||||
|
||||
$cfg = <<<EOT
|
||||
[global]
|
||||
error_log = {{FILE:LOG}}
|
||||
[unconfined]
|
||||
listen = {{ADDR}}
|
||||
pm = dynamic
|
||||
pm.max_children = 5
|
||||
pm.start_servers = 1
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 3
|
||||
php_admin_value[cgi.fix_pathinfo] = no
|
||||
php_admin_value[cgi.discard_path] = no
|
||||
EOT;
|
||||
|
||||
$code = <<<EOT
|
||||
<?php
|
||||
echo \$_SERVER["SCRIPT_NAME"] . "\n";
|
||||
echo \$_SERVER["SCRIPT_FILENAME"] . "\n";
|
||||
echo \$_SERVER["PATH_INFO"] . "\n";
|
||||
echo \$_SERVER["PHP_SELF"];
|
||||
EOT;
|
||||
|
||||
$tester = new FPM\Tester($cfg, $code);
|
||||
[$sourceFilePath, $scriptName] = $tester->createSourceFileAndScriptName();
|
||||
$tester->start();
|
||||
$tester->expectLogStartNotices();
|
||||
$tester
|
||||
->request(
|
||||
headers: [
|
||||
'PATH_INFO' => '/pinfo',
|
||||
'PATH_TRANSLATED' => $sourceFilePath,
|
||||
],
|
||||
uri: $scriptName . '/pinfo',
|
||||
scriptFilename: $sourceFilePath . '/pinfo', // used just for variable display
|
||||
scriptName: $scriptName,
|
||||
)
|
||||
->expectBody([$scriptName, $sourceFilePath . '/pinfo', '/pinfo', '/pinfo']);
|
||||
$tester->terminate();
|
||||
$tester->close();
|
||||
|
||||
?>
|
||||
Done
|
||||
--EXPECT--
|
||||
Done
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "tester.inc";
|
||||
FPM\Tester::clean();
|
||||
?>
|
56
sapi/fpm/tests/fcgi-env-nopif-custom-with-pi-without-pt.phpt
Normal file
56
sapi/fpm/tests/fcgi-env-nopif-custom-with-pi-without-pt.phpt
Normal file
@ -0,0 +1,56 @@
|
||||
--TEST--
|
||||
FPM: FastCGI env var no path info fix for custom setup with PATH_INFO and without PATH_TRANSLATED
|
||||
--SKIPIF--
|
||||
<?php include "skipif.inc"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once "tester.inc";
|
||||
|
||||
$cfg = <<<EOT
|
||||
[global]
|
||||
error_log = {{FILE:LOG}}
|
||||
[unconfined]
|
||||
listen = {{ADDR}}
|
||||
pm = dynamic
|
||||
pm.max_children = 5
|
||||
pm.start_servers = 1
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 3
|
||||
php_admin_value[cgi.fix_pathinfo] = no
|
||||
EOT;
|
||||
|
||||
$code = <<<EOT
|
||||
<?php
|
||||
echo \$_SERVER["SCRIPT_NAME"] . "\n";
|
||||
echo \$_SERVER["SCRIPT_FILENAME"] . "\n";
|
||||
echo \$_SERVER["PATH_INFO"] . "\n";
|
||||
echo \$_SERVER["PHP_SELF"];
|
||||
EOT;
|
||||
|
||||
$tester = new FPM\Tester($cfg, $code);
|
||||
[$sourceFilePath, $scriptName] = $tester->createSourceFileAndScriptName();
|
||||
$tester->start();
|
||||
$tester->expectLogStartNotices();
|
||||
$tester
|
||||
->request(
|
||||
headers: [
|
||||
'PATH_INFO' => '/pinfo',
|
||||
],
|
||||
uri: $scriptName . '/pinfo',
|
||||
scriptFilename: $sourceFilePath,
|
||||
scriptName: $scriptName,
|
||||
)
|
||||
->expectBody([$scriptName, $sourceFilePath, '/pinfo', '/pinfo']);
|
||||
$tester->terminate();
|
||||
$tester->close();
|
||||
|
||||
?>
|
||||
Done
|
||||
--EXPECT--
|
||||
Done
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "tester.inc";
|
||||
FPM\Tester::clean();
|
||||
?>
|
56
sapi/fpm/tests/fcgi-env-nopif-custom-without-pi-with-pt.phpt
Normal file
56
sapi/fpm/tests/fcgi-env-nopif-custom-without-pi-with-pt.phpt
Normal file
@ -0,0 +1,56 @@
|
||||
--TEST--
|
||||
FPM: FastCGI env var no path info fix for custom setup without PATH_INFO and with PATH_TRANSLATED
|
||||
--SKIPIF--
|
||||
<?php include "skipif.inc"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once "tester.inc";
|
||||
|
||||
$cfg = <<<EOT
|
||||
[global]
|
||||
error_log = {{FILE:LOG}}
|
||||
[unconfined]
|
||||
listen = {{ADDR}}
|
||||
pm = dynamic
|
||||
pm.max_children = 5
|
||||
pm.start_servers = 1
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 3
|
||||
php_admin_value[cgi.fix_pathinfo] = no
|
||||
php_admin_value[cgi.discard_path] = no
|
||||
EOT;
|
||||
|
||||
$code = <<<EOT
|
||||
<?php
|
||||
echo \$_SERVER["SCRIPT_NAME"] . "\n";
|
||||
echo \$_SERVER["SCRIPT_FILENAME"] . "\n";
|
||||
echo \$_SERVER["PHP_SELF"];
|
||||
EOT;
|
||||
|
||||
$tester = new FPM\Tester($cfg, $code);
|
||||
[$sourceFilePath, $scriptName] = $tester->createSourceFileAndScriptName();
|
||||
$tester->start();
|
||||
$tester->expectLogStartNotices();
|
||||
$tester
|
||||
->request(
|
||||
headers: [
|
||||
'PATH_TRANSLATED' => $sourceFilePath,
|
||||
],
|
||||
uri: $scriptName . '/pinfo',
|
||||
scriptFilename: $sourceFilePath . '/pinfo', // should be ignored as PATH_TRANSLATED is used
|
||||
scriptName: $scriptName,
|
||||
)
|
||||
->expectBody([$scriptName, $sourceFilePath . '/pinfo', $scriptName]);
|
||||
$tester->terminate();
|
||||
$tester->close();
|
||||
|
||||
?>
|
||||
Done
|
||||
--EXPECT--
|
||||
Done
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "tester.inc";
|
||||
FPM\Tester::clean();
|
||||
?>
|
@ -0,0 +1,52 @@
|
||||
--TEST--
|
||||
FPM: FastCGI env var no path info fix for custom setup without PATH_INFO and PATH_TRANSLATED
|
||||
--SKIPIF--
|
||||
<?php include "skipif.inc"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once "tester.inc";
|
||||
|
||||
$cfg = <<<EOT
|
||||
[global]
|
||||
error_log = {{FILE:LOG}}
|
||||
[unconfined]
|
||||
listen = {{ADDR}}
|
||||
pm = dynamic
|
||||
pm.max_children = 5
|
||||
pm.start_servers = 1
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 3
|
||||
php_admin_value[cgi.fix_pathinfo] = no
|
||||
EOT;
|
||||
|
||||
$code = <<<EOT
|
||||
<?php
|
||||
echo \$_SERVER["SCRIPT_NAME"] . "\n";
|
||||
echo \$_SERVER["SCRIPT_FILENAME"] . "\n";
|
||||
echo \$_SERVER["PHP_SELF"];
|
||||
EOT;
|
||||
|
||||
$tester = new FPM\Tester($cfg, $code);
|
||||
[$sourceFilePath, $scriptName] = $tester->createSourceFileAndScriptName();
|
||||
$tester->start();
|
||||
$tester->expectLogStartNotices();
|
||||
$tester
|
||||
->request(
|
||||
uri: $scriptName . '/pinfo',
|
||||
scriptFilename: $sourceFilePath,
|
||||
scriptName: $scriptName,
|
||||
)
|
||||
->expectBody([$scriptName, $sourceFilePath, $scriptName]);
|
||||
$tester->terminate();
|
||||
$tester->close();
|
||||
|
||||
?>
|
||||
Done
|
||||
--EXPECT--
|
||||
Done
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "tester.inc";
|
||||
FPM\Tester::clean();
|
||||
?>
|
58
sapi/fpm/tests/fcgi-env-nopif-custom-without-sf-with-pt.phpt
Normal file
58
sapi/fpm/tests/fcgi-env-nopif-custom-without-sf-with-pt.phpt
Normal file
@ -0,0 +1,58 @@
|
||||
--TEST--
|
||||
FPM: FastCGI env var no path info fix for custom setup without SCRIPT_FILENAME and with PATH_TRANSLATED
|
||||
--SKIPIF--
|
||||
<?php include "skipif.inc"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once "tester.inc";
|
||||
|
||||
$cfg = <<<EOT
|
||||
[global]
|
||||
error_log = {{FILE:LOG}}
|
||||
[unconfined]
|
||||
listen = {{ADDR}}
|
||||
pm = dynamic
|
||||
pm.max_children = 5
|
||||
pm.start_servers = 1
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 3
|
||||
php_admin_value[cgi.fix_pathinfo] = no
|
||||
php_admin_value[cgi.discard_path] = yes
|
||||
EOT;
|
||||
|
||||
$code = <<<EOT
|
||||
<?php
|
||||
echo \$_SERVER["SCRIPT_NAME"] . "\n";
|
||||
echo \$_SERVER["SCRIPT_FILENAME"] ?? 'unset' . "\n";
|
||||
echo \$_SERVER["PATH_INFO"] . "\n";
|
||||
echo \$_SERVER["PHP_SELF"];
|
||||
EOT;
|
||||
|
||||
$tester = new FPM\Tester($cfg, $code);
|
||||
[$sourceFilePath, $scriptName] = $tester->createSourceFileAndScriptName();
|
||||
$tester->start();
|
||||
$tester->expectLogStartNotices();
|
||||
$tester
|
||||
->request(
|
||||
headers: [
|
||||
'PATH_INFO' => '/pinfo',
|
||||
'PATH_TRANSLATED' => $sourceFilePath,
|
||||
],
|
||||
uri: $scriptName . '/pinfo',
|
||||
scriptFilename: '',
|
||||
scriptName: $scriptName,
|
||||
)
|
||||
->expectBody([$scriptName, 'unset', '/pinfo', '/pinfo']);
|
||||
$tester->terminate();
|
||||
$tester->close();
|
||||
|
||||
?>
|
||||
Done
|
||||
--EXPECT--
|
||||
Done
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "tester.inc";
|
||||
FPM\Tester::clean();
|
||||
?>
|
Loading…
Reference in New Issue
Block a user