diff options
author | Ferenc Kovacs <tyrael@php.net> | 2014-08-12 14:47:03 +0200 |
---|---|---|
committer | Ferenc Kovacs <tyrael@php.net> | 2014-08-12 14:47:03 +0200 |
commit | 844e2e81f56fca1f49c73df4e15866cd1ba37f30 (patch) | |
tree | b088b2873d37c9d11a9a8d310821b6e135844889 | |
parent | 00fe640b19431d7b59aea697f3b66ae5bb920f59 (diff) | |
parent | 37c08f466ec1bdb0909989a2fab54352d368d37c (diff) | |
download | php-git-844e2e81f56fca1f49c73df4e15866cd1ba37f30.tar.gz |
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"
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_main.c | 28 |
2 files changed, 31 insertions, 0 deletions
@@ -15,6 +15,9 @@ PHP NEWS . Fixed bug #67705 (extensive backtracking in rule regular expression). (CVE-2014-3538) (Remi) +- FPM: + . Fix bug #67606 (revised fix 67541, broke mod_fastcgi BC). (David Zuelke) + - GD: . Fixed bug #66901 (php-gd 'c_color' NULL pointer dereference). (CVE-2014-2497) (Remi) diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 2ee1456340..cd5492d73d 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -1148,6 +1148,22 @@ static void init_request_info(TSRMLS_D) TRANSLATE_SLASHES(env_document_root); } + 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 */ + env_script_name = env_redirect_url; + } + #ifdef __riscos__ /* Convert path to unix format*/ __riscosify_control |= __RISCOSIFY_DONT_CHECK_DIR; @@ -1325,6 +1341,18 @@ static void init_request_info(TSRMLS_D) } script_path_translated = _sapi_cgibin_putenv("SCRIPT_FILENAME", script_path_translated TSRMLS_CC); } + 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); + } + if (orig_path_translated) { + _sapi_cgibin_putenv("ORIG_PATH_TRANSLATED", orig_path_translated TSRMLS_CC); + _sapi_cgibin_putenv("PATH_TRANSLATED", NULL TSRMLS_CC); + } + } if (env_script_name != orig_script_name) { if (orig_script_name) { _sapi_cgibin_putenv("ORIG_SCRIPT_NAME", orig_script_name TSRMLS_CC); |