dmitry          Tue Jun 26 14:47:33 2007 UTC

  Modified files:              
    /php-src/sapi/cgi   cgi_main.c 
  Log:
  Fixed bug #40419 (Trailing Slash in CGI request don't work)
  
  
http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.326&r2=1.327&diff_format=u
Index: php-src/sapi/cgi/cgi_main.c
diff -u php-src/sapi/cgi/cgi_main.c:1.326 php-src/sapi/cgi/cgi_main.c:1.327
--- php-src/sapi/cgi/cgi_main.c:1.326   Thu Jun 21 08:40:56 2007
+++ php-src/sapi/cgi/cgi_main.c Tue Jun 26 14:47:33 2007
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: cgi_main.c,v 1.326 2007/06/21 08:40:56 dmitry Exp $ */
+/* $Id: cgi_main.c,v 1.327 2007/06/26 14:47:33 dmitry Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -738,9 +738,9 @@
                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 @@
                                        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 @@
                                } 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) {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to