File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
lib/internal/Magento/Framework/Config/Reader Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -161,9 +161,28 @@ protected function _readFiles($fileList)
161161 );
162162 }
163163 }
164+
164165 if ($ this ->validationState ->isValidationRequired ()) {
165166 $ errors = [];
166167 if ($ configMerger && !$ configMerger ->validate ($ this ->_schemaFile , $ errors )) {
168+ // The merged XML is invalid, but each XML document is
169+ // individually valid. (If they had errors, we've have thrown an
170+ // exception in the loop above.) Let's work out which document
171+ // is causing us a problem.
172+ $ configMerger = null ;
173+ foreach ($ fileList as $ key => $ content ) {
174+ if (!$ configMerger ) {
175+ $ configMerger = $ this ->_createConfigMerger ($ this ->_domDocumentClass , $ content );
176+ } else {
177+ $ configMerger ->merge ($ content );
178+ }
179+
180+ if (!$ configMerger ->validate ($ this ->_schemaFile )) {
181+ array_unshift ($ errors , "Error in merged XML after reading $ key " );
182+ break ;
183+ }
184+ }
185+
167186 $ message = "Invalid Document \n" ;
168187 throw new \Magento \Framework \Exception \LocalizedException (
169188 new \Magento \Framework \Phrase ($ message . implode ("\n" , $ errors ))
You can’t perform that action at this time.
0 commit comments