Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-39378 s(): fix bad hex regex

commit dc67a0e9b613175b04641c35d597ffc8219e3b0e 1 parent 5e00b9a
@timhunt timhunt authored
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));
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.