From: rkhb at gmx dot net Operating system: Windows XP Pro SP2 PHP version: 5.2.4RC3 PHP Bug Type: DOM XML related Bug description: get_class(DOMNodelist->item()) reports wrong class
Description: ------------ get_class(DOMNodelist->item()) reports 'DOMElement'. In the documentation as well as in the W3C-Recommendation this should be 'DOMNode'. http://www.php.net/manual/en/function.dom-domnodelist-item.php http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-536297177 I had required the correct result for building a own "print_r"... Reproduce code: --------------- error_reporting (E_ALL | E_STRICT); echo "PHP: ", PHP_VERSION, "\r\n"; $doc = new DOMDocument; $doc->loadHTML('<html><head><title>First</title><meta name="author" content="rkhb"></head><body></body></html>'); $heads = $doc->getElementsByTagName('head'); // -> DomNodeList echo '$heads: ' , get_class($heads),"\r\n"; $head = $heads->item(0); // -> DomNode echo '$head: ' , get_class($head),"\r\n"; $childs = $head->childNodes; // -> DomNodeList echo '$childs: ',get_class($childs),"\r\n"; $child = $childs->item(0); // -> DomNode; echo '$child: ',get_class($child),"\r\n"; echo '$child->nodeName: ',$child->nodeName,"\r\n"; echo '$child->tagName: ',$child->tagName,"\r\n"; echo '$child->undefined: ',$child->undefined,"\r\n"; echo '$child->nextSibling->nodeName: ',$child->nextSibling->nodeName,"\r\n"; Expected result: ---------------- HP: 5.2.4RC4-dev $heads: DOMNodeList $head: DOMNode $childs: DOMNodeList $child: DOMNode $child->nodeName: title $child->tagName: Notice: Undefined property: DOMNode::$tagName in C:\Projekte\PHP-CLI\Neu1.php on line 25 $child->undefined: Notice: Undefined property: DOMNode::$undefined in C:\Projekte\PHP-CLI\Neu1.php on line 25 $child->nextSibling->nodeName: meta Actual result: -------------- HP: 5.2.4RC4-dev $heads: DOMNodeList $head: DOMElement $childs: DOMNodeList $child: DOMElement $child->nodeName: title $child->tagName: title $child->undefined: Notice: Undefined property: DOMElement::$undefined in C:\Projekte\PHP-CLI\Neu1.php on line 25 $child->nextSibling->nodeName: meta -- Edit bug report at http://bugs.php.net/?id=42451&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42451&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42451&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42451&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42451&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42451&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42451&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42451&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42451&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42451&r=support Expected behavior: http://bugs.php.net/fix.php?id=42451&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42451&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42451&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42451&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42451&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42451&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42451&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42451&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42451&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42451&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42451&r=mysqlcfg