From ab5e153aa79373da21fa9126fc4a59e5e619b5f0 Mon Sep 17 00:00:00 2001 From: Patrick McLain Date: Fri, 22 Dec 2017 08:23:53 -0500 Subject: [PATCH] Throw ValidationException for invalid xml This change ensures the offending file path is output in the error report. --- app/code/Magento/Config/Model/Config/Structure/Reader.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Config/Model/Config/Structure/Reader.php b/app/code/Magento/Config/Model/Config/Structure/Reader.php index 5916649588bcb..c83c2e1ae1320 100644 --- a/app/code/Magento/Config/Model/Config/Structure/Reader.php +++ b/app/code/Magento/Config/Model/Config/Structure/Reader.php @@ -124,6 +124,7 @@ protected function _readFiles($fileList) * Processing nodes of the document before merging * * @param string $content + * @throws \Magento\Framework\Config\Dom\ValidationException * @return string */ protected function processingDocument($content) @@ -131,7 +132,12 @@ protected function processingDocument($content) $object = new DataObject(); $document = new \DOMDocument(); - $document->loadXML($content); + try { + $document->loadXML($content); + } catch (\Exception $e) { + throw new \Magento\Framework\Config\Dom\ValidationException($e->getMessage()); + } + $this->compiler->compile($document->documentElement, $object, $object); return $document->saveXML();