Skip to content

Commit bff0ec8

Browse files
committed
Merge branch 'PHP-8.4'
2 parents d3e5dbe + 74d4e67 commit bff0ec8

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

sapi/fpm/fpm/fpm_main.c

+7-5
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,7 @@ static void init_request_info(void)
11511151
}
11521152

11531153
if (tflag) {
1154+
char *decoded_path_info = NULL;
11541155
if (orig_path_info) {
11551156
char old;
11561157

@@ -1172,7 +1173,6 @@ static void init_request_info(void)
11721173
* As we can extract PATH_INFO from PATH_TRANSLATED
11731174
* it is probably also in SCRIPT_NAME and need to be removed
11741175
*/
1175-
char *decoded_path_info = NULL;
11761176
size_t decoded_path_info_len = 0;
11771177
if (strchr(path_info, '%')) {
11781178
decoded_path_info = estrdup(path_info);
@@ -1195,11 +1195,13 @@ static void init_request_info(void)
11951195
env_script_name[env_script_file_info_start] = 0;
11961196
SG(request_info).request_uri = FCGI_PUTENV(request, "SCRIPT_NAME", env_script_name);
11971197
}
1198-
if (decoded_path_info) {
1199-
efree(decoded_path_info);
1200-
}
12011198
}
1202-
env_path_info = FCGI_PUTENV(request, "PATH_INFO", path_info);
1199+
if (decoded_path_info) {
1200+
env_path_info = FCGI_PUTENV(request, "PATH_INFO", decoded_path_info);
1201+
efree(decoded_path_info);
1202+
} else {
1203+
env_path_info = FCGI_PUTENV(request, "PATH_INFO", path_info);
1204+
}
12031205
}
12041206
if (!orig_script_filename ||
12051207
strcmp(orig_script_filename, pt) != 0) {

sapi/fpm/tests/fcgi-env-pif-apache-pp-sn-strip-encoded-plus.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ $tester
3939
scriptFilename: "proxy:fcgi://" . $tester->getAddr() . $sourceFilePath . '/1%20+2',
4040
scriptName: $scriptName . '/1 +2'
4141
)
42-
->expectBody([$scriptName, $scriptName . '/1 +2', $sourceFilePath, '/1%20+2', $scriptName . '/1%20+2']);
42+
->expectBody([$scriptName, $scriptName . '/1 +2', $sourceFilePath, '/1 +2', $scriptName . '/1 +2']);
4343
$tester->terminate();
4444
$tester->close();
4545

sapi/fpm/tests/fcgi-env-pif-apache-pp-sn-strip-encoded.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ $tester
3939
scriptFilename: "proxy:fcgi://" . $tester->getAddr() . $sourceFilePath . '/1%202',
4040
scriptName: $scriptName . '/1 2'
4141
)
42-
->expectBody([$scriptName, $scriptName . '/1 2', $sourceFilePath, '/1%202', $scriptName . '/1%202']);
42+
->expectBody([$scriptName, $scriptName . '/1 2', $sourceFilePath, '/1 2', $scriptName . '/1 2']);
4343
$tester->terminate();
4444
$tester->close();
4545

0 commit comments

Comments
 (0)