#36600 [Bgs]: DOMDocument::loadXML() within derived class broken
| From: | georg at howen dot de | Date: | Fri, 03 Mar 2006 09:38:40 +0000 |
| Subject: | #36600 [Bgs]: DOMDocument::loadXML() within derived class broken | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-93875@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
Bug Type: DOM XML related
Operating System: Linux, Win XP
PHP Version: 5.1.2
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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