Share » Forums » Developer » Bug?: php api cgi + mod_rewrite + nVH...

Bug?: php api cgi + mod_rewrite + nVH + ForceVirtualHost=true

Bug?: php api cgi + mod_rewrite + nVH + ForceVirtualHost=true

Wednesday 12 January 2005 12:32:30 am - 6 replies

Author Message

Derick Rethans

Wednesday 12 January 2005 12:45:58 am

I think this is a bug, which I fixed (but not committed yet). Can you try the following:

Index: lib/ezutils/classes/ezsys.php
===================================================================
--- lib/ezutils/classes/ezsys.php   (revision 10512)
+++ lib/ezutils/classes/ezsys.php   (working copy)
@@ -615,7 +615,7 @@
      \return the variable named \a $variableName in the global \c $_SERVER variable.
              If the variable is not present an error is shown and \c null is returned.
     */
-    function &serverVariable( $variableName, $quiet = false )
+    function serverVariable( $variableName, $quiet = false )
     {
         if ( !isset( $_SERVER[$variableName] ) )
         {
@@ -780,6 +780,7 @@
             eZDebug::writeNotice( eZSys::serverVariable( 'PHP_SELF' ), 'PHP_SELF' );
             eZDebug::writeNotice( eZSys::serverVariable( 'SCRIPT_FILENAME' ), 'SCRIPT_FILENAME' );
             eZDebug::writeNotice( eZSys::serverVariable( 'DOCUMENT_ROOT' ), 'DOCUMENT_ROOT' );
+            eZDebug::writeNotice( eZSys::serverVariable( 'REQUEST_URI' ), 'REQUEST_URI' );
             eZDebug::writeNotice( ini_get( 'include_path' ), 'include_path' );
         }

@@ -825,6 +826,7 @@
         $scriptName = eZSys::serverVariable( 'SCRIPT_NAME' );
         // Get the webdir.

+        $wwwDir = "";
         if ( $force_VirtualHost && ! $isCGI )
         {
             $wwwDir = "";
@@ -868,7 +870,18 @@
                 // Get the right $_SERVER['REQUEST_URI'], when using nVH setup.
                 if ( ereg( "^$wwwDir$index(.*)", $phpSelf, $req ) )
                 {
-                    $requestURI = $req[1];
+                    if (! $req[1] )
+                    {
+                        if ( ereg( "^$wwwDir(.*)", $requestURI, $req ) )
+                        {
+                            $requestURI = $req[1];
+                            $index = '';
+                        }
+                    }
+                    else
+                    {
+                        $requestURI = $req[1];
+                    }
                 }
             }
         }

The reason why it's not committed yet because I couldn't test it in a lot of different situations yet.

Lazaro Ferreira

Wednesday 12 January 2005 12:56:19 am

Hi,

I've tried this without sucess :

http://ez.no/community/forum/install_configuration/htaccess_hidden_at_last

 

Lazaro
http://www.mzbusiness.com

Björn Dieding@xrow.de

Wednesday 12 January 2005 1:15:12 am

Thx Derick,

I give it a try and let you know.

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

Björn Dieding@xrow.de

Wednesday 12 January 2005 5:06:01 am

http://www.ez.no/bugs/view/6085

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

Derick Rethans

Monday 17 January 2005 4:06:12 am

Hmm, your patch does work for me, and so does mine... but I couldn't reproduce the "wrong" case from before I wrote this patch... strange.

Björn Dieding@xrow.de

Monday 17 January 2005 4:17:22 am

Have you tested your patch with mod_rw and forcevirtualhost=true then it should fail because it still prepends the "index.php?" in urls...

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu