#43685 [Opn]: Dom->importNode() returns FALSE instead of the Exception
| From: | rrichards@php.net | Date: | Thu, 27 Dec 2007 12:35:15 +0000 |
| Subject: | #43685 [Opn]: Dom->importNode() returns FALSE instead of the Exception | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-384@lists.php.net to get a copy of this message | ||
ID: 43685
Updated by: rrichards@php.net
Reported By: programatorfreez at gmail dot com
Status: Open
-Bug Type: DOM XML related
+Bug Type: Documentation problem
Operating System: Gentoo GNU/Linux
PHP Version: 5.2.5
New Comment:
Documentation issue. Method return false when node cannot be copied.
Previous Comments:
------------------------------------------------------------------------
[2007-12-27 02:44:55] programatorfreez at gmail dot com
Description:
------------
There is a DomException in the documentation of Dom->importNode(), but
it returns FALSE on fail without a reason.
Reproduce code:
---------------
/**
* Import node to dom
*
* @param DomElement node which will be imported
* @param boolean deep (use recursive importing - default TRUE)
* @return DomElement reference to created node
*/
public function domImportNode($node, $deep = TRUE) {
if (FALSE === ($sxe = $this->dom->importNode($node, $deep))) {
throw new Exception('importNode failed.');
}
$sxe = $this->dom->appendChild($sxe);
return $sxe;
}
Expected result:
----------------
DomException
Actual result:
--------------
My Exception
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43685&edit=1