Skip to content

Commit

Permalink
More robust $ent_list for $smcFunc functions
Browse files Browse the repository at this point in the history
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
  • Loading branch information
Sesquipedalian committed Jun 16, 2021
1 parent 66e0a75 commit 00ca9e8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Sources/Load.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,17 @@ function reloadSettings()
$context['utf8'] = $utf8;

// Set a list of common functions.
$ent_list = '&(?:#' . (empty($modSettings['disableEntityCheck']) ? '\d{1,7}' : '021') . '|quot|amp|lt|gt|nbsp);';
if (!empty($modSettings['disableEntityCheck']))
$named_entities = array('&amp;', '&lt;', '&gt;', '&quot;', '&apos;', '&nbsp;');
else
$named_entities = array_unique(array_merge(
array_values(get_html_translation_table(HTML_ENTITIES)),
array_values(get_html_translation_table(HTML_ENTITIES, ENT_QUOTES | ENT_HTML5)),
));

$ent_list = '&(?'.'>#(?'.'>\d+|x[0-9a-fA-F]+)|' . build_regex(array_map(function ($ent) {
return substr($ent, 1, -1);
}, $named_entities), '~') . ');';

// global array of anonymous helper functions, used mostly to properly handle multi byte strings
$smcFunc += array(
Expand Down

0 comments on commit 00ca9e8

Please # to comment.