Is there any chance or any cause to broke the site due to spaces in di.xml file in Magento 2


If di.xml can be broken the site. But it depends on the code.

if you did the wrong code at di.xml and it related files then the site will be broken.

Most of the cases, the 3rd party modules have created the issue. So you should disabled that extension one by one Check which modules are created the issue.

| improve this answer | |
  • I had override contact us, controller, its working fine but in the di.xml file, some lines are commented at the top of the XML file it makes an issue...? – suresh-vagvala Jul 2 '18 at 8:59
  • As this xml files, so, <?xml will be at first line of file. – Amit Bera Jul 2 '18 at 9:00
  • <!--<?xml version="1.0"?> <config xmlns:xsi="w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="\Magento\Contact\Controller\Index\Post" type="test\..\..\..\Post" /> </config> --> <?xml version="1.0"?> <config xmlns:xsi="w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> <preference for="\Magento\Contact\Controller\Index\Post" type="test\..\..\..\Post"/> </config> – suresh-vagvala Jul 2 '18 at 9:04
  • this is my di.xml file..is it make any issue..? – suresh-vagvala Jul 2 '18 at 9:04
  • Yes, it should create an issue.Please write proper XML file – Amit Bera Jul 2 '18 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.