I recently re-opened an old (1 year) Symfony project and I am having an error on every page (I don't remember having this issue a year ago) :
[exception] 500 | Internal Server Error | Symfony\Component\Config\Exception\FileLoaderLoadException
/var/www/[...]/wdt.xml
ContextErrorException: Notice: Undefined property: DOMDocument::$documentElement
If I clear the cache, the error disappear but as soon as I edit and save a file, the error is showing up again. The project was using Symfony 2.8 and I updated to Symfony 3.2 but it didn't solve the issue.
I don't think the problem is related to the wdt.xml file and I think it might be related to my laptop config.
I don't really know where to start to investigate so any suggestion is welcome!
Edit 1 :
I am actually having the same problem with another project I created few days ago. The project don't use any additional bundles and I just created 5 entities and generated the MySQL database.
Edit 2 :
After some more researched, I decided to create a new Ubuntu VM and test a new Symfony project and it just work perfectly so it must be something to do with the configuration on my laptop.
Edit 3 :
After some more tests, here is what I get when I add a print_r($dom); in the file XmlUtils.php (vendor/symfony/symfony/src/Symfony/Component/Config/Util/XmlUtils.php) line 59 :
Ubuntu VM (no error) :
DOMDocument Object ( [doctype] => [implementation] => (object value omitted) [documentElement] => (object value omitted) [actualEncoding] => [encoding] => [xmlEncoding] => [standalone] => 1 [xmlStandalone] => 1 [version] => 1.0 [xmlVersion] => 1.0 [strictErrorChecking] => 1 [documentURI] => /var/www/my_project/web/ [config] => [formatOutput] => [validateOnParse] => 1 [resolveExternals] => [preserveWhiteSpace] => 1 [recover] => [substituteEntities] => [nodeName] => #document [nodeValue] => [nodeType] => 9 [parentNode] => [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => [attributes] => [ownerDocument] => [namespaceURI] => [prefix] => [localName] => [baseURI] => /var/www/my_project/web/ [textContent] => %kernel.charset% %kernel.default_locale% )
Ubuntu laptop (error) :
DOMDocument Object ( [validateOnParse] => 1 [nodeName] => #document [nodeValue] => [nodeType] => 9 [parentNode] => [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => [attributes] => [ownerDocument] => [namespaceURI] => [prefix] => [localName] => [baseURI] => /var/www/lab/symfony/booklib/web/ [textContent] => %kernel.charset% %kernel.default_locale% )
It looks like there is some missing information on my laptop...
So basically, the function $dom->loadXML doesn't return the same value on my laptop environment and inside the VM... any idea why?