]> granicus.if.org Git - php/commitdiff
When Apache use RewriteRule to redirect, via mod_proxy_fgi, to php-fpm
authorRemi Collet <remi@php.net>
Tue, 30 Apr 2013 06:55:18 +0000 (08:55 +0200)
committerRemi Collet <remi@php.net>
Tue, 30 Apr 2013 06:55:18 +0000 (08:55 +0200)
the SCRIPT_FILENAME may contains the QUERY_STRING.

Ex : RewriteRule ^(.*)\.php$ fcgi://127.0.0.1:9000/$1.php [P]

From apache debug (build with -DFCGI_DUMP_ENV_VARS)
AH01062: sending env var 'SCRIPT_FILENAME' value 'proxy:fcgi://127.0.0.1:9000/var/www/html/info.php?foo'
AH01071: Got error 'Primary script unknown\n'

NEWS
sapi/fpm/fpm/fpm_main.c

diff --git a/NEWS b/NEWS
index 2527cfce9d2078c5fbd848008a704e15c3b892b1..3a9199be711e5d503c65a554cc9bece9c5ba2d44 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2013, PHP 5.4.16
 
+- FPM:
+  . Ignore QUERY_STRING when sent in SCRIPT_FILENAME. (Remi)
+
 ?? ??? 2013, PHP 5.4.15
 - Core:
   . Fixed bug #64578 (debug_backtrace in set_error_handler corrupts zend heap: 
index 61088c465be9c21bc931d5a3aaffc50e7ff09228..28ed0be99487ef2198dcc85bacff868089d22f3e 100644 (file)
@@ -1098,7 +1098,7 @@ static void init_request_info(TSRMLS_D)
 
 #define APACHE_PROXY_FCGI_PREFIX "proxy:fcgi://"
                /* Fix proxy URLs in SCRIPT_FILENAME generated by Apache mod_proxy_fcgi:
-                *     proxy:fcgi://localhost:9000/some-dir/info.php/test
+                *     proxy:fcgi://localhost:9000/some-dir/info.php/test?foo=bar
                 * should be changed to:
                 *     /some-dir/info.php/test
                 * See: http://bugs.php.net/bug.php?id=54152
@@ -1118,6 +1118,11 @@ static void init_request_info(TSRMLS_D)
                                memmove(env_script_filename, p, strlen(p) + 1);
                                apache_was_here = 1;
                        }
+                       /* ignore query string if sent by Apache (RewriteRule) */
+                       p = strchr(env_script_filename, '?');
+                       if (p) {
+                               *p =0;
+                       }
                }
 
                if (CGIG(fix_pathinfo)) {