From: Dmitry Stogov Date: Tue, 26 Jun 2007 14:47:16 +0000 (+0000) Subject: Fixed bug #40419 (Trailing Slash in CGI request don't work) X-Git-Tag: php-5.2.4RC1~286 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e5909f149c569c64a24afbd053a5e6a85ca263d3;p=php Fixed bug #40419 (Trailing Slash in CGI request don't work) --- diff --git a/NEWS b/NEWS index 8cd511005e..8c27a3996f 100644 --- a/NEWS +++ b/NEWS @@ -88,6 +88,7 @@ PHP NEWS integer as sections). (Tony) - Fixed bug #41350 (my_thread_global_end() error during request shutdown on Windows). (Scott, Andrey) +- Fixed bug #40419 (Trailing Slash in CGI request don't work). (Dmitry) - Fixed bug #39330 (apache2handler does not call shutdown actions before apache child die). (isk at ecommerce dot com, Gopal, Tony) diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 67559d6895..bf58269751 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -766,7 +766,7 @@ static void init_request_info(TSRMLS_D) char *env_document_root = sapi_cgibin_getenv("DOCUMENT_ROOT", sizeof("DOCUMENT_ROOT")-1 TSRMLS_CC); if (CGIG(fix_pathinfo)) { - char *real_path; + char *real_path = NULL; char *orig_path_translated = env_path_translated; char *orig_path_info = env_path_info; char *orig_script_name = env_script_name; @@ -926,6 +926,9 @@ static void init_request_info(TSRMLS_D) efree(pt); } } else { + if (real_path) { + script_path_translated = real_path; + } /* make sure path_info/translated are empty */ if (!orig_script_filename || (script_path_translated != orig_script_filename) || @@ -951,8 +954,10 @@ static void init_request_info(TSRMLS_D) } else { SG(request_info).request_uri = env_script_name; } + if (real_path) { + free(real_path); + } } - free(real_path); } else { #endif /* pre 4.3 behaviour, shouldn't be used but provides BC */