I am struggling with this problem for hours now... I've succeeded to narrow a problem with Symfony3 and realized it's related to PHP only.
When I execute the following code on 2 different environments (inside / outside a VM), I get 2 different outputs.
$dom = new \DOMDocument();
print_r($dom);
$dom->loadXML('<root><node/></root>');
print_r($dom->documentElement);
Outside the VM :
DOMDocument Object (
[nodeName] => #document
[nodeValue] =>
[nodeType] => 9
[parentNode] =>
[childNodes] => (object value omitted)
[firstChild] =>
[lastChild] =>
[previousSibling] =>
[attributes] =>
[ownerDocument] =>
[namespaceURI] =>
[prefix] =>
[localName] =>
[baseURI] =>
[textContent] =>
)
Notice: Undefined property: DOMDocument::$documentElement in /var/www/lab/xml/index.php on line 9
Inside the VM:
DOMDocument Object (
[doctype] =>
[implementation] => (object value omitted)
[documentElement] =>
[actualEncoding] =>
[encoding] =>
[xmlEncoding] =>
[standalone] => 1
[xmlStandalone] => 1
[version] => 1.0
[xmlVersion] => 1.0
[strictErrorChecking] => 1
[documentURI] =>
[config] =>
[formatOutput] =>
[validateOnParse] =>
[resolveExternals] =>
[preserveWhiteSpace] => 1
[recover] =>
[substituteEntities] =>
[nodeName] => #document
[nodeValue] =>
[nodeType] => 9
[parentNode] =>
[childNodes] => (object value omitted)
[firstChild] =>
[lastChild] =>
[previousSibling] =>
[attributes] =>
[ownerDocument] =>
[namespaceURI] =>
[prefix] =>
[localName] =>
[baseURI] =>
[textContent] =>
)
DOMElement Object (
[tagName] => root
[schemaTypeInfo] =>
[nodeName] => root
[nodeValue] =>
[nodeType] => 1
[parentNode] => (object value omitted)
[childNodes] => (object value omitted)
[firstChild] => (object value omitted)
[lastChild] => (object value omitted)
[previousSibling] =>
[attributes] => (object value omitted)
[ownerDocument] => (object value omitted)
[namespaceURI] =>
[prefix] =>
[localName] => root
[baseURI] => /var/www/xml/
[textContent] =>
)
Any idea?
Edit 1 : I have the same config on both environments (from phpinfo) :
xml:
XML Support: active
XML Namespace Support: active
libxml2: Version 2.9.3
libXML:
libXML support: active
libXML Compiled Version: 2.9.3
libXML Loaded Version: 20903
libXML streams: enabled
SimpleXML:
Revision: $Id: b8b5c37931a53e50a937c0aef2a26d351e173215 $
Schema support: enabled