File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
lib/internal/Magento/Framework Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ function ($errorNumber, $errorString) {
91
91
throw new \Exception ($ errorString , $ errorNumber );
92
92
}
93
93
);
94
+ $ data = $ this ->prepareUnescapedCharacters ($ data );
94
95
$ string = mb_convert_encoding ($ data , 'HTML-ENTITIES ' , 'UTF-8 ' );
95
96
try {
96
97
$ domDocument ->loadHTML (
@@ -119,6 +120,19 @@ function ($errorNumber, $errorString) {
119
120
return $ result ;
120
121
}
121
122
123
+ /**
124
+ * Used to replace characters, that mb_convert_encoding will not process
125
+ *
126
+ * @param string $data
127
+ * @return string|null
128
+ */
129
+ private function prepareUnescapedCharacters (string $ data ): ?string
130
+ {
131
+ $ patterns = ['/\&/u ' ];
132
+ $ replacements = ['& ' ];
133
+ return \preg_replace ($ patterns , $ replacements , $ data );
134
+ }
135
+
122
136
/**
123
137
* Remove not allowed tags
124
138
*
You can’t perform that action at this time.
0 commit comments