Fix broken regular expression
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 1 Aug 2009 19:15:13 +0000 (19:15 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 1 Aug 2009 19:15:13 +0000 (19:15 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@13808 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/url_parser.php

index 73ef9843afaf3d6c0a37bd085b5fd609e467f7bc..3d82192c1cd904986245b5c094a8cf3ac61371d3 100644 (file)
@@ -35,10 +35,12 @@ function replaceBlock (&$in, $replace, $start, $end) {
  */
 /* Here's enough: */
 global $IP_RegExp_Match, $Host_RegExp_Match, $Email_RegExp_Match;
  */
 /* Here's enough: */
 global $IP_RegExp_Match, $Host_RegExp_Match, $Email_RegExp_Match;
+//FIXME: these were written for use in an ereg().... they are now being used in preg()... we need to run some tests to make sure they are fully working still
 $IP_RegExp_Match = '\\[?[0-9]{1,3}(\\.[0-9]{1,3}){3}\\]?';
 $Host_RegExp_Match = '(' . $IP_RegExp_Match .
     '|[0-9a-z]([-.]?[0-9a-z])*\\.[a-z][a-z]+)';
 $IP_RegExp_Match = '\\[?[0-9]{1,3}(\\.[0-9]{1,3}){3}\\]?';
 $Host_RegExp_Match = '(' . $IP_RegExp_Match .
     '|[0-9a-z]([-.]?[0-9a-z])*\\.[a-z][a-z]+)';
-$atext = '([a-z0-9!#$&%*+/=?^_`{|}~-]|&amp;)';
+// NB: the backslash in the following line escapes the forward slash, which assumes that the regular expression will be enclosed in /.../
+$atext = '([a-z0-9!#$&%*+\/=?^_`{|}~-]|&amp;)';
 $dot_atom = $atext . '+(\.' . $atext . '+)*';
 $Email_RegExp_Match = $dot_atom . '(%' . $Host_RegExp_Match . ')?@' .
                       $Host_RegExp_Match;
 $dot_atom = $atext . '+(\.' . $atext . '+)*';
 $Email_RegExp_Match = $dot_atom . '(%' . $Host_RegExp_Match . ')?@' .
                       $Host_RegExp_Match;