Permalink
Browse files

MDL-39378 s(): fix bad hex regex

  • Loading branch information...
1 parent cf5a329 commit 0c6f9e759b122b54f71b386bdd1270d8e8d7e132 @timhunt timhunt committed Apr 26, 2013
Showing with 2 additions and 1 deletion.
  1. +1 −0 lib/tests/weblib_test.php
  2. +1 −1 lib/weblib.php
View
1 lib/tests/weblib_test.php
@@ -72,6 +72,7 @@ function test_format_string() {
function test_s() {
$this->assertEquals(s("This Breaks \" Strict"), "This Breaks " Strict");
$this->assertEquals(s("This Breaks <a>\" Strict</a>"), "This Breaks &lt;a&gt;&quot; Strict&lt;/a&gt;");
+ $this->assertEquals('An entity: &#x09ff;.', s('An entity: &#x09ff;.'));
}
function test_format_text_email() {
View
2 lib/weblib.php
@@ -97,7 +97,7 @@ function s($var, $obsolete = false) {
return '0';
}
- return preg_replace("/&amp;#(\d+|x[0-7a-fA-F]+);/i", "&#$1;", htmlspecialchars($var, ENT_QUOTES, 'UTF-8', true));
+ return preg_replace("/&amp;#(\d+|x[0-9a-f]+);/i", "&#$1;", htmlspecialchars($var, ENT_QUOTES, 'UTF-8', true));
}
/**

0 comments on commit 0c6f9e7

Please sign in to comment.