Fixed decode_unicode_url() trying to parse non-hex %uXXXX sequences
authorDan
Mon, 06 Jul 2009 11:26:21 -0400
changeset 1035 d0d617124b29
parent 1034 15fa1b4e730a
child 1036 589e6e7e5243
Fixed decode_unicode_url() trying to parse non-hex %uXXXX sequences
includes/functions.php
--- a/includes/functions.php	Sun Jul 05 00:57:53 2009 -0400
+++ b/includes/functions.php	Mon Jul 06 11:26:21 2009 -0400
@@ -2851,6 +2851,13 @@
     $character = $str[$i];
     if ($character == '%' && $str[$i + 1] == 'u')
     {
+      if ( !preg_match('/^([a-f0-9]{2})+$/', substr($str, $i + 2, 4)) )
+      {
+        $res .= substr($str, $i, 6);
+        $i += 6;
+        continue;
+      }
+      
       $value = hexdec(substr($str, $i + 2, 4));
       $i += 6;