Skip to content

Commit 844e2e8

Browse files
committed
Merge branch 'pr-765' into PHP-5.6
* pr-765: NEWS entry for e6d93a1 / d73d44c restore FPM compatibility with mod_fastcgi broken since #694 / 67541, fixes bug 67606 Revert "Merge branch 'pull-request/694' into PHP-5.6"
2 parents 00fe640 + 37c08f4 commit 844e2e8

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ PHP NEWS
1515
. Fixed bug #67705 (extensive backtracking in rule regular expression).
1616
(CVE-2014-3538) (Remi)
1717

18+
- FPM:
19+
. Fix bug #67606 (revised fix 67541, broke mod_fastcgi BC). (David Zuelke)
20+
1821
- GD:
1922
. Fixed bug #66901 (php-gd 'c_color' NULL pointer dereference).
2023
(CVE-2014-2497) (Remi)

sapi/fpm/fpm/fpm_main.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,22 @@ static void init_request_info(TSRMLS_D)
11481148
TRANSLATE_SLASHES(env_document_root);
11491149
}
11501150

1151+
if (!apache_was_here && env_path_translated != NULL && env_redirect_url != NULL &&
1152+
env_path_translated != script_path_translated &&
1153+
strcmp(env_path_translated, script_path_translated) != 0) {
1154+
/*
1155+
* pretty much apache specific. If we have a redirect_url
1156+
* then our script_filename and script_name point to the
1157+
* php executable
1158+
* we don't want to do this for the new mod_proxy_fcgi approach,
1159+
* where redirect_url may also exist but the below will break
1160+
* with rewrites to PATH_INFO, hence the !apache_was_here check
1161+
*/
1162+
script_path_translated = env_path_translated;
1163+
/* we correct SCRIPT_NAME now in case we don't have PATH_INFO */
1164+
env_script_name = env_redirect_url;
1165+
}
1166+
11511167
#ifdef __riscos__
11521168
/* Convert path to unix format*/
11531169
__riscosify_control |= __RISCOSIFY_DONT_CHECK_DIR;
@@ -1325,6 +1341,18 @@ static void init_request_info(TSRMLS_D)
13251341
}
13261342
script_path_translated = _sapi_cgibin_putenv("SCRIPT_FILENAME", script_path_translated TSRMLS_CC);
13271343
}
1344+
if (!apache_was_here && env_redirect_url) {
1345+
/* if we used PATH_TRANSLATED to work around Apache mod_fastcgi (but not mod_proxy_fcgi,
1346+
* hence !apache_was_here) weirdness, strip info accordingly */
1347+
if (orig_path_info) {
1348+
_sapi_cgibin_putenv("ORIG_PATH_INFO", orig_path_info TSRMLS_CC);
1349+
_sapi_cgibin_putenv("PATH_INFO", NULL TSRMLS_CC);
1350+
}
1351+
if (orig_path_translated) {
1352+
_sapi_cgibin_putenv("ORIG_PATH_TRANSLATED", orig_path_translated TSRMLS_CC);
1353+
_sapi_cgibin_putenv("PATH_TRANSLATED", NULL TSRMLS_CC);
1354+
}
1355+
}
13281356
if (env_script_name != orig_script_name) {
13291357
if (orig_script_name) {
13301358
_sapi_cgibin_putenv("ORIG_SCRIPT_NAME", orig_script_name TSRMLS_CC);

0 commit comments

Comments
 (0)