com php-src: restore FPM compatibility with mod_fastcgi bro ken since #694 / 67541, fixes b ug 67606: sapi/fpm/fpm/fpm_main.c
| From: | Ferenc Kovacs | Date: | Sat, 09 Aug 2014 06:26:33 +0000 |
| Subject: | com php-src: restore FPM compatibility with mod_fastcgi bro ken since #694 / 67541, fixes b ug 67606: sapi/fpm/fpm/fpm_main.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-79822@lists.php.net to get a copy of this message | ||
Commit: e6d93a11ad343efdc42315f7f69ed82515c9f374
Author: David Zuelke <dzuelke@gmail.com> Sat, 9 Aug 2014 08:26:33 +0200
Parents: d73d44c23709df5b6bebf347cd98088ddd6c8091
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e6d93a11ad343efdc42315f7f69ed82515c9f374
Log:
restore FPM compatibility with mod_fastcgi broken since #694 / 67541, fixes bug 67606
Bugs:
https://bugs.php.net/694
https://bugs.php.net/67606
Changed paths:
M sapi/fpm/fpm/fpm_main.c
Diff:
diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c
index 9309083..cd5492d 100644
--- a/sapi/fpm/fpm/fpm_main.c
+++ b/sapi/fpm/fpm/fpm_main.c
@@ -1148,13 +1148,16 @@ static void init_request_info(TSRMLS_D)
TRANSLATE_SLASHES(env_document_root);
}
- if (env_path_translated != NULL && env_redirect_url != NULL &&
+ if (!apache_was_here && env_path_translated != NULL && env_redirect_url != NULL
&&
env_path_translated != script_path_translated &&
strcmp(env_path_translated, script_path_translated) != 0) {
/*
* pretty much apache specific. If we have a redirect_url
* then our script_filename and script_name point to the
* php executable
+ * we don't want to do this for the new mod_proxy_fcgi approach,
+ * where redirect_url may also exist but the below will break
+ * with rewrites to PATH_INFO, hence the !apache_was_here check
*/
script_path_translated = env_path_translated;
/* we correct SCRIPT_NAME now in case we don't have PATH_INFO */
@@ -1329,7 +1332,7 @@ static void init_request_info(TSRMLS_D)
efree(pt);
}
} else {
- /* make sure path_info/translated are empty */
+ /* make sure original values are remembered in ORIG_ copies if we've changed them */
if (!orig_script_filename ||
(script_path_translated != orig_script_filename &&
strcmp(script_path_translated, orig_script_filename) != 0)) {
@@ -1338,7 +1341,9 @@ static void init_request_info(TSRMLS_D)
}
script_path_translated = _sapi_cgibin_putenv("SCRIPT_FILENAME",
script_path_translated TSRMLS_CC);
}
- if (env_redirect_url) {
+ if (!apache_was_here && env_redirect_url) {
+ /* if we used PATH_TRANSLATED to work around Apache mod_fastcgi (but not mod_proxy_fcgi,
+ * hence !apache_was_here) weirdness, strip info accordingly */
if (orig_path_info) {
_sapi_cgibin_putenv("ORIG_PATH_INFO", orig_path_info TSRMLS_CC);
_sapi_cgibin_putenv("PATH_INFO", NULL TSRMLS_CC);