[Solar-svn] Revision 2596

pmjones at solarphp.com pmjones at solarphp.com
Sat Jul 14 15:03:58 CDT 2007


Solar_Valid: [FIX] Apparently, chr(255) as a regex delimiter does not work on Windows.  Changed to use "{" and "}" in the uri() method.  Thanks, Rodrigo.


Modified: trunk/Solar/Valid.php
===================================================================
--- trunk/Solar/Valid.php	2007-07-14 02:40:12 UTC (rev 2595)
+++ trunk/Solar/Valid.php	2007-07-14 20:03:58 UTC (rev 2596)
@@ -887,8 +887,8 @@
      * 
      * @param mixed $value The value to validate.
      * 
-     * @param string|array $schemes Allowed schemes for the URI;
-     * for example, http, https, ftp.  If null, all schemes are allowed.
+     * @param string|array $schemes Allowed schemes for the URI; for example,
+     * array('http', 'https', 'ftp').  If null, all schemes are allowed.
      * 
      * @param bool $blank Allow blank values to be valid.
      * 
@@ -904,9 +904,8 @@
         }
         
         // TAKEN (almost) DIRECTLY FROM PEAR_VALIDATE::URI()
-        $delim = chr(255);
         $result = preg_match(
-            $delim . '^(?:([a-z][-+.a-z0-9]*):)?                                        # 1. scheme
+            '{^(?:([a-z][-+.a-z0-9]*):)?                                                # 1. scheme
             (?://                                                                       #    authority start
             (?:((?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'();:&=+$,])*)@)?                         # 2. authority-userinfo
             (?:((?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\.)*[a-z](?:[-a-z0-9]*[a-z0-9])?\.?)  # 3. authority-hostname OR
@@ -915,7 +914,8 @@
             ((?:/(?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'():@&=+$,;])*)+)?                       # 6. path
             (?:\?([^#]*))?                                                              # 7. query
             (?:\#((?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'();/?:@&=+$,])*))?                     # 8. fragment
-            $' . $delim . 'xi', $value, $matches);
+            $}xi', $value, $matches
+        );
         
         if ($result) {
             




More information about the Solar-svn mailing list