From: Dmitry Stogov Date: Tue, 26 Jun 2007 14:47:33 +0000 (+0000) Subject: Fixed bug #40419 (Trailing Slash in CGI request don't work) X-Git-Tag: BEFORE_IMPORT_OF_MYSQLND~382 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a5a98e632237ba548d07df3c047acef33f93109d;p=php Fixed bug #40419 (Trailing Slash in CGI request don't work) --- diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 15a4ffa662..94ecad14cb 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -738,9 +738,9 @@ static void init_request_info(TSRMLS_D) char *env_path_info = sapi_cgibin_getenv("PATH_INFO", sizeof("PATH_INFO")-1 TSRMLS_CC); char *env_script_name = sapi_cgibin_getenv("SCRIPT_NAME", sizeof("SCRIPT_NAME")-1 TSRMLS_CC); - if (CGIG(fix_pathinfo)) { + if (CGIG(fix_pathinfo)) { struct stat st; - char *real_path; + char *real_path = NULL; char *env_redirect_url = sapi_cgibin_getenv("REDIRECT_URL", sizeof("REDIRECT_URL")-1 TSRMLS_CC); char *env_document_root = sapi_cgibin_getenv("DOCUMENT_ROOT", sizeof("DOCUMENT_ROOT")-1 TSRMLS_CC); char *orig_path_translated = env_path_translated; @@ -902,6 +902,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) || @@ -927,8 +930,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 { /* pre 4.3 behaviour, shouldn't be used but provides BC */ if (env_path_info) {