#36600 [Bgs->Opn]: DOMDocument::loadXML() within derived class broken

From: Date: Fri, 03 Mar 2006 10:42:25 +0000
Subject: #36600 [Bgs->Opn]: DOMDocument::loadXML() within derived class broken
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-93877@lists.php.net to get a copy of this message
ID: 36600 User updated by: georg at howen dot de Reported By: georg at howen dot de -Status: Bogus +Status: Open Bug Type: DOM XML related Operating System: Linux, Win XP PHP Version: 5.1.2 New Comment: Changed status back to open since I believe that $internal_doc2 = DOMDocument::loadXML($xml); is a static call that does not return what it should. If I didn't get something right I am really sorry, but I still believe this is a bug. Previous Comments: ------------------------------------------------------------------------ [2006-03-03 10:38:40] georg at howen dot de Hi, I thought I was aware of that. But isn't $internal_doc2 = DOMDocument::loadXML($xml); a static call to DOMDocument? That's the one that works fine _outside_ of a DOMDocument but not inside a class that extends DOMDocument. ------------------------------------------------------------------------ [2006-03-03 10:20:33] bjori@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php DOMDocument::loadXML will return DOMDocument only when called staticly ------------------------------------------------------------------------ [2006-03-03 09:55:29] georg at howen dot de Description: ------------ If you extend DOMDocument and try to use DOMDocument::loadXML() on a new DOMDocument within the extended class, this function will return true instead of a new instance of DOMDocument. Reproduce code: --------------- <?php class xDOMDocument extends DOMDocument { public function newDom($xml) { $internal_doc1 = new DOMDocument; $internal_doc1->loadXML($xml); print_r($internal_doc1); $internal_doc2 = DOMDocument::loadXML($xml); print_r($internal_doc2); } } $xml = '<def>Test</def>'; $dom = new xDOMDocument(); $dom->newDom($xml); Expected result: ---------------- DOMDocument Object ( ) DOMDocument Object ( ) Actual result: -------------- DOMDocument Object ( ) 1 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36600&edit=1

« previous php.bugs (#93877) next »