1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix GH-17643: FPM with httpd ProxyPass encoded PATH_INFO env

Closes GH-17644
This commit is contained in:
Jakub Zelenka
2025-01-30 19:03:19 +01:00
parent fd5d6ad5bd
commit e48ceb0026
4 changed files with 13 additions and 7 deletions

4
NEWS
View File

@@ -14,6 +14,10 @@ PHP NEWS
. Fixed bug GH-17718 (Calling static methods on an interface that has
`__callStatic` is allowed). (timwolla)
- FPM:
. Fixed bug GH-17643 (FPM with httpd ProxyPass encoded PATH_INFO env).
(Jakub Zelenka)
- LDAP:
. Fixed bug GH-17704 (ldap_search fails when $attributes contains a
non-packed array with numerical keys). (nielsdos, 7u83)

View File

@@ -1153,6 +1153,7 @@ static void init_request_info(void)
}
if (tflag) {
char *decoded_path_info = NULL;
if (orig_path_info) {
char old;
@@ -1174,7 +1175,6 @@ static void init_request_info(void)
* As we can extract PATH_INFO from PATH_TRANSLATED
* it is probably also in SCRIPT_NAME and need to be removed
*/
char *decoded_path_info = NULL;
size_t decoded_path_info_len = 0;
if (strchr(path_info, '%')) {
decoded_path_info = estrdup(path_info);
@@ -1197,11 +1197,13 @@ static void init_request_info(void)
env_script_name[env_script_file_info_start] = 0;
SG(request_info).request_uri = FCGI_PUTENV(request, "SCRIPT_NAME", env_script_name);
}
if (decoded_path_info) {
efree(decoded_path_info);
}
}
env_path_info = FCGI_PUTENV(request, "PATH_INFO", path_info);
if (decoded_path_info) {
env_path_info = FCGI_PUTENV(request, "PATH_INFO", decoded_path_info);
efree(decoded_path_info);
} else {
env_path_info = FCGI_PUTENV(request, "PATH_INFO", path_info);
}
}
if (!orig_script_filename ||
strcmp(orig_script_filename, pt) != 0) {

View File

@@ -39,7 +39,7 @@ $tester
scriptFilename: "proxy:fcgi://" . $tester->getAddr() . $sourceFilePath . '/1%20+2',
scriptName: $scriptName . '/1 +2'
)
->expectBody([$scriptName, $scriptName . '/1 +2', $sourceFilePath, '/1%20+2', $scriptName . '/1%20+2']);
->expectBody([$scriptName, $scriptName . '/1 +2', $sourceFilePath, '/1 +2', $scriptName . '/1 +2']);
$tester->terminate();
$tester->close();

View File

@@ -39,7 +39,7 @@ $tester
scriptFilename: "proxy:fcgi://" . $tester->getAddr() . $sourceFilePath . '/1%202',
scriptName: $scriptName . '/1 2'
)
->expectBody([$scriptName, $scriptName . '/1 2', $sourceFilePath, '/1%202', $scriptName . '/1%202']);
->expectBody([$scriptName, $scriptName . '/1 2', $sourceFilePath, '/1 2', $scriptName . '/1 2']);
$tester->terminate();
$tester->close();