Skip to content

Commit 08b9e8a

Browse files
committed
Merge branch 'PHP-8.3'
2 parents d54e2f9 + 1c7dc0f commit 08b9e8a

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

sapi/fpm/fpm/fpm_main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,7 @@ static void init_request_info(void)
11681168
size_t decoded_path_info_len = 0;
11691169
if (strchr(path_info, '%')) {
11701170
decoded_path_info = estrdup(path_info);
1171-
decoded_path_info_len = php_url_decode(decoded_path_info, strlen(path_info));
1171+
decoded_path_info_len = php_raw_url_decode(decoded_path_info, strlen(path_info));
11721172
}
11731173
size_t snlen = strlen(env_script_name);
11741174
size_t env_script_file_info_start = 0;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
--TEST--
2+
FPM: FastCGI env var path info fix for Apache ProxyPass SCRIPT_NAME encoded path and plush sign (GH-12996)
3+
--SKIPIF--
4+
<?php include "skipif.inc"; ?>
5+
--FILE--
6+
<?php
7+
8+
require_once "tester.inc";
9+
10+
$cfg = <<<EOT
11+
[global]
12+
error_log = {{FILE:LOG}}
13+
[unconfined]
14+
listen = {{ADDR}}
15+
pm = dynamic
16+
pm.max_children = 5
17+
pm.start_servers = 1
18+
pm.min_spare_servers = 1
19+
pm.max_spare_servers = 3
20+
php_admin_value[cgi.fix_pathinfo] = yes
21+
EOT;
22+
23+
$code = <<<EOT
24+
<?php
25+
echo \$_SERVER["SCRIPT_NAME"] . "\n";
26+
echo \$_SERVER["ORIG_SCRIPT_NAME"] . "\n";
27+
echo \$_SERVER["SCRIPT_FILENAME"] . "\n";
28+
echo \$_SERVER["PATH_INFO"] . "\n";
29+
echo \$_SERVER["PHP_SELF"];
30+
EOT;
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%20+2',
40+
scriptName: $scriptName . '/1 +2'
41+
)
42+
->expectBody([$scriptName, $scriptName . '/1 +2', $sourceFilePath, '/1%20+2', $scriptName . '/1%20+2']);
43+
$tester->terminate();
44+
$tester->close();
45+
46+
?>
47+
Done
48+
--EXPECT--
49+
Done
50+
--CLEAN--
51+
<?php
52+
require_once "tester.inc";
53+
FPM\Tester::clean();
54+
?>

0 commit comments

Comments
 (0)