1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 14:00:31 +02:00

Merge pull request #3618 from marc1706/ticket/13832

[ticket/13832] Use preg_replace_callback instead of /e modifier
This commit is contained in:
Tristan Darricau
2015-06-24 16:36:15 +02:00
5 changed files with 138 additions and 32 deletions

View File

@@ -140,8 +140,12 @@ function html_entity_decode_utf8($string)
static $trans_tbl;
// replace numeric entities
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'code2utf8(hexdec("\\1"))', $string);
$string = preg_replace('~&#([0-9]+);~e', 'code2utf8(\\1)', $string);
$string = preg_replace_callback('~&#x([0-9a-f]+);~i', function ($match) {
return code2utf8(hexdec($match[1]));
}, $string);
$string = preg_replace_callback('~&#([0-9]+);~', function ($match) {
return code2utf8($match[1]);
}, $string);
// replace literal entities
if (!isset($trans_tbl))