Skip to content

Commit d23cfbc

Browse files
authored
Merge pull request #203 from magento-gl/Hammer_Regression_Blocker_issues_16jan22
Hammer_Regression_Blocker_issues_16jan22
2 parents d3978f8 + 6565f36 commit d23cfbc

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

app/code/Magento/PageBuilder/Model/Filter/Template.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,11 @@ function ($errorNumber, $errorString) {
170170
throw new DOMException($errorString, $errorNumber);
171171
}
172172
);
173-
$string = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8');
173+
$string = mb_encode_numericentity(
174+
$html,
175+
['HTML-ENTITIES','','',''],
176+
'UTF-8'
177+
);
174178
try {
175179
libxml_use_internal_errors(true);
176180
// LIBXML_SCHEMA_CREATE option added according to this message

app/code/Magento/PageBuilder/Model/Stage/HtmlFilter.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,16 @@ public function __construct(
4141
public function filterHtml(string $content): string
4242
{
4343
$dom = new \DOMDocument('1.0', 'UTF-8');
44+
$previous = '';
4445
try {
4546
//this code is required because of https://bugs.php.net/bug.php?id=60021
4647
$previous = libxml_use_internal_errors(true);
4748
$content = '<div>' . $content . '</div>';
48-
$string = mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8');
49+
$string = mb_encode_numericentity(
50+
$content,
51+
['HTML-ENTITIES','','',''],
52+
'UTF-8'
53+
);
4954
$dom->loadHTML($string, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
5055
} catch (\Exception $e) {
5156
$this->loggerInterface->critical($e->getMessage());

0 commit comments

Comments
 (0)