Author: jablko
Date: Sat Nov 28 11:45:45 2009
New Revision: 3988

Log:
Fix ::pathInfo() regex in case path info prefix is empty, fixes issue 1127

Modified:
   trunk/lib/Qubit.class.php

Modified: trunk/lib/Qubit.class.php
==============================================================================
--- trunk/lib/Qubit.class.php   Sat Nov 28 11:34:42 2009        (r3987)
+++ trunk/lib/Qubit.class.php   Sat Nov 28 11:45:45 2009        (r3988)
@@ -21,6 +21,11 @@
 {
   public static function pathInfo($url)
   {
-    return 
preg_replace('/.*'.preg_quote(sfContext::getInstance()->request->getPathInfoPrefix(),
 '/').'/', null, $url);
+    // Other options to get path info from URL include parse_url() or building
+    // an exact regex from the BNF in RFC 1738. Note however that our only goal
+    // is to get path info from valid URL, which the following simple regex
+    // should accomplish. Slash characters don't occur in the scheme, user,
+    // password, host, or port component of valid URL.
+    return 
preg_replace('/^[^\/]*'.preg_quote(sfContext::getInstance()->request->getPathInfoPrefix(),
 '/').'/', null, $url);
   }
 }

--

You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.


Reply via email to