Edit report at https://bugs.php.net/bug.php?id=63742&edit=1
ID: 63742 User updated by: giso at connectholland dot nl Reported by: giso at connectholland dot nl Summary: Stack tree DOMDocument::registerNodeClass incorrect Status: Open Type: Bug Package: DOM XML related Operating System: Linux / Debian -PHP Version: 5.3.19 +PHP Version: 5.3.3 Block user comment: N Private report: N New Comment: Add class MyDOMNode extends DOMNode {} class MyDOMElement extends DOMElement {} to the reproduction script Previous Comments: ------------------------------------------------------------------------ [2012-12-11 16:50:30] giso at connectholland dot nl Description: ------------ When using DOMDocument::registerNodeClass for both DOMElement and DOMNode a DOMElement does nog get to be a child of the registered DOMNode class Test script: --------------- <?php class MyDOMDocument extends DOMDocument { public function __construct($version = null, $encoding = null) { parent::__construct($version, $encoding); $this->registerNodeClass("DOMNode", "MyDOMNode"); $this->registerNodeClass("DOMElement", "MyDOMElement"); } } $dom = new MyDOMDocument(); $dom->loadXML("<root/>"); $parent_class_names = array(); $parent_class_name = get_class($dom->documentElement); do { $parent_class_names[] = $parent_class_name; } while($parent_class_name = get_parent_class($parent_class_name)); var_dump($parent_class_names); ?> Expected result: ---------------- array (size=4) 0 => string 'MyDOMElement' (length=12) 1 => string 'DOMElement' (length=10) 2 => string 'MyDOMNode' (length=9) 3 => string 'DOMNode' (length=7) Actual result: -------------- array (size=3) 0 => string 'MyDOMElement' (length=12) 1 => string 'DOMElement' (length=10) 2 => string 'DOMNode' (length=7) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63742&edit=1