Fix for DOMDocument behavior for newer PHP versions.