1414use Magento \Framework \Phrase ;
1515
1616/**
17- * Class Dom
18- *
1917 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2018 * @api
2119 * @since 100.0.2
@@ -25,12 +23,12 @@ class Dom
2523 /**
2624 * Prefix which will be used for root namespace
2725 */
28- const ROOT_NAMESPACE_PREFIX = 'x ' ;
26+ public const ROOT_NAMESPACE_PREFIX = 'x ' ;
2927
3028 /**
3129 * Format of items in errors array to be used by default. Available placeholders - fields of \LibXMLError.
3230 */
33- const ERROR_FORMAT_DEFAULT = "%message% \nLine: %line% \n" ;
31+ public const ERROR_FORMAT_DEFAULT = "%message% \nLine: %line% \n" ;
3432
3533 /**
3634 * @var \Magento\Framework\Config\ValidationStateInterface
@@ -262,6 +260,8 @@ private function findCdataSection($node)
262260 return $ childNode ;
263261 }
264262 }
263+
264+ return null ;
265265 }
266266
267267 /**
@@ -407,9 +407,9 @@ private static function _renderErrorMessage(\LibXMLError $errorInfo, $format)
407407 foreach ($ errorInfo as $ field => $ value ) {
408408 $ placeholder = '% ' . $ field . '% ' ;
409409 $ value = trim ((string )$ value );
410- $ result = str_replace ($ placeholder , $ value , $ result );
410+ $ result = $ result !== null ? str_replace ($ placeholder , $ value , $ result ) : '' ;
411411 }
412- if (strpos ($ result , '% ' ) !== false ) {
412+ if ($ result && strpos ($ result , '% ' ) !== false ) {
413413 if (preg_match_all ('/%.+%/ ' , $ result , $ matches )) {
414414 $ unsupported = [];
415415 foreach ($ matches [0 ] as $ placeholder ) {
0 commit comments