In short, it's introduction of namespaces (feature of PHP 5.3 quite heavily used by ZF2 - but not ZF 1.x) that caused this bug. With this line...
$dom = new DOMDocument(...)
... only the currently imported namespace is checked for this class by ZF. And it results in failure, because DOMDocument
class actually belongs to the global namespace.
The solution is simple, when you see the reason: use the global namespace specifier
- \
symbol - in front of the class name. Like this:
$dom = new \DOMDocument(...)