Skip to content

Commit 1c7dc0f

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
2 parents 04954f6 + b04b09e commit 1c7dc0f

File tree

3 files changed

+59
-1
lines changed

3 files changed

+59
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ PHP NEWS
66
. Fixed timer leak in zend-max-execution-timers builds. (withinboredom)
77
. Fixed bug GH-12349 (linking failure on ARM with mold). (Jan Palus)
88

9+
- FPM:
10+
. Fixed bug GH-12996 (Incorrect SCRIPT_NAME with Apache ProxyPassMatch when
11+
plus in path). (Jakub Zelenka)
12+
913
- Phar:
1014
. Fixed bug #71465 (PHAR doesn't know about litespeed). (nielsdos)
1115

sapi/fpm/fpm/fpm_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,7 @@ static void init_request_info(void)
11651165
size_t decoded_path_info_len = 0;
11661166
if (strchr(path_info, '%')) {
11671167
decoded_path_info = estrdup(path_info);
1168-
decoded_path_info_len = php_url_decode(decoded_path_info, strlen(path_info));
1168+
decoded_path_info_len = php_raw_url_decode(decoded_path_info, strlen(path_info));
11691169
}
11701170
size_t snlen = strlen(env_script_name);
11711171
size_t env_script_file_info_start = 0;
Lines changed: 54 additions & 0 deletions
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)