MDL-24282 improved s() to deal better with hex encoded entities
authorPetr Skoda <skodak@moodle.org>
Sun, 19 Sep 2010 15:27:00 +0000 (15:27 +0000)
committerPetr Skoda <skodak@moodle.org>
Sun, 19 Sep 2010 15:27:00 +0000 (15:27 +0000)
lib/weblib.php

index 2656885..aaabf20 100644 (file)
@@ -121,7 +121,7 @@ function s($var, $obsolete = false) {
         return '0';
     }
 
         return '0';
     }
 
-    return preg_replace("/&amp;(#\d+);/i", "&$1;", htmlspecialchars($var));
+    return preg_replace("/&amp;#(\d+|x[0-7a-fA-F]+);/i", "&#$1;", htmlspecialchars($var, ENT_QUOTES, 'UTF-8', false));
 }
 
 /**
 }
 
 /**