php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #43685 Dom->importNode() returns FALSE instead of the Exception
Submitted: 2007-12-27 02:44 UTC Modified: 2007-12-28 17:47 UTC
From: programatorfreez at gmail dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 5.2.5 OS: Gentoo GNU/Linux
Private report: No CVE-ID: None
 [2007-12-27 02:44 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-12-27 12:35 UTC] rrichards@php.net
Documentation issue. Method return false when node cannot be copied.
 [2007-12-28 17:47 UTC] felipe@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Aug 17 19:00:03 2025 UTC