From: David Soria Parra Date: Fri, 9 Jan 2009 22:14:20 +0000 (+0000) Subject: MFH: Fixed bug #47042 (PHP cgi sapi is removing SCRIPT_FILENAME for non apache). X-Git-Tag: php-5.2.9RC1~132 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aa3fc149113a146d1e168c248a917c59bd5e7505;p=php MFH: Fixed bug #47042 (PHP cgi sapi is removing SCRIPT_FILENAME for non apache). --- diff --git a/NEWS b/NEWS index ef17e76256..5cee3fbea7 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,8 @@ PHP NEWS APA Laboratory (Fixes CVE-2008-5498). (Scott) - Fixed a segfault when malformed string is passed to json_decode(). (Scott) +- Fixed bug #47042 (PHP cgi sapi is removing SCRIPT_FILENAME for non apache). + (Sriram Natarajan) - Fixed bug #47037 (No error when using fopen with empty string). (Cristian Rodriguez R., Felipe) - Fixed bug #47035 (dns_get_record returns a garbage byte at the end of a TXT diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 4dbb3ccdf9..d0a2689186 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -960,7 +960,9 @@ static void init_request_info(TSRMLS_D) TRANSLATE_SLASHES(env_document_root); } - if (env_path_translated != NULL && env_redirect_url != NULL) { + if (env_path_translated != NULL && env_redirect_url != NULL && + orig_script_filename != NULL && script_path_translated != NULL && + strcmp(orig_script_filename, script_path_translated) != 0) { /* pretty much apache specific. If we have a redirect_url then our script_filename and script_name point to the