From:             giso at connectholland dot nl
Operating system: Linux / Debian
PHP version:      5.3.19
Package:          DOM XML related
Bug Type:         Bug
Bug description:Stack tree DOMDocument::registerNodeClass incorrect

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 bug report at https://bugs.php.net/bug.php?id=63742&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=63742&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=63742&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=63742&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=63742&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=63742&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=63742&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=63742&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=63742&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=63742&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=63742&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=63742&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=63742&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=63742&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63742&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=63742&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=63742&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=63742&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63742&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=63742&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63742&r=mysqlcfg

Reply via email to