Skip to content

Commit 735267d

Browse files
committed
Internal: Fix deprecated calls to mb_convert_encoding() to encode to HTML entities. Helps support PHP 8.3
1 parent 2542b38 commit 735267d

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

main/inc/lib/internationalization.lib.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,7 @@ function api_htmlentities($string, $quote_style = ENT_COMPAT, $encoding = 'UTF-8
12071207
break;
12081208
}
12091209

1210-
return mb_convert_encoding($string, 'HTML-ENTITIES', 'UTF-8');
1210+
return htmlentities($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
12111211
}
12121212

12131213
/**

main/inc/lib/xajax/xajaxResponse.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ public function _cmdXML($aAttributes, $sData)
542542
} //if (function_exists('mb_convert_encoding')) {
543543
elseif (function_exists('mb_convert_encoding')) {
544544
//
545-
$sData = call_user_func_array('mb_convert_encoding', array(&$sData, 'HTML-ENTITIES', $this->sEncoding));
545+
$sData = call_user_func_array('htmlentities', array(&$sData, ENT_QUOTES | ENT_SUBSTITUTE, $this->sEncoding));
546546
} else {
547547
trigger_error(
548548
"The xajax XML response output could not be converted to HTML entities because the mb_convert_encoding function is not available",

plugin/migrationmoodle/src/Transformer/Property/ReplaceFilePaths.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function transform(array $data)
2828

2929
$doc = new \DOMDocument();
3030
$doc->loadHTML(
31-
mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8')
31+
htmlentities($content, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8')
3232
);
3333

3434
foreach ($doc->getElementsByTagName('img') as $img) {

0 commit comments

Comments
 (0)