magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Error 500 when an empty XML file is present

Open MorganGonzales opened this issue 10 years ago • 4 comments

I'm receiving the following error when I created an empty XML file somewhere within my config folder.

PHP Catchable fatal error: Argument 1 passed to Magento\Framework\Config\Dom::_mergeNode() must be an instance of DOMElement, null given, called in /Users/user/Sites/m2-training/vendor/magento/framework/Config/Dom.php on line 122 and defined in /Users/user/Sites/m2-training/vendor/magento/framework/Config/Dom.php on line 138

I think Magento should not prompt a 500 error when we are in the process of preparing out our XML files. Unless there's a fault in syntax.

MorganGonzales avatar Feb 11 '16 09:02 MorganGonzales

I'm receiving the following error when I created an empty XML file

A completely empty XML file is syntactically invalid; see https://www.w3.org/TR/xml/#sec-documents

benmarks avatar Feb 11 '16 12:02 benmarks

i think Magento should not fail to load if any of the XML files in config dir or anywhere else is empty, invalid in xml parsing or invalid in xml schema validation..

i think everyone would prefer to load frontend with wrong files skipped and to show some error message in the admin area so that admin is notified

scholtz avatar Feb 12 '16 16:02 scholtz

@scholtz

i think Magento should not fail to load if any of the XML files in config dir or anywhere else is empty, invalid in xml parsing or invalid in xml schema validation..

This is how the system functions in production mode, though, preparing the system for production mode requires valid files and module state.

i think everyone would prefer to load frontend with wrong files skipped and to show some error message in the admin area so that admin is notified

Can you support this claim about "everyone" with data? I can think of no good reason for invalid files to be accommodated. Warning an administrator via the GUI does not seem appropriate, as this condition is necessarily a low-level concern which should be handled by developers.

benmarks avatar Feb 12 '16 18:02 benmarks

According to contributor guide, tickets without response for two weeks should be closed. Please feel free to reopen if it's needed.

palamar avatar Jul 07 '16 14:07 palamar