|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46191 Back-comp break: DOMDocument::saveXML() doesn't accept null anymore
Submitted: 2008-09-28 10:09 UTC Modified: 2008-09-28 12:04 UTC
From: zizka at seznam dot cz Assigned:
Status: Closed Package: DOM XML related
PHP Version: 5.2.6 OS: Any
Private report: No CVE-ID:
 [2008-09-28 10:09 UTC] zizka at seznam dot cz
In PHP 5.2.5, DOMDocument::saveXML() accepted null as it's first argument, which has this documentation:

Use this parameter to output only a specific node without XML declaration rather than the entire document. 

In PHP 5.2.6, passing null causes error.

Reproduce code:
// $doc is a DOM document object.
return $doc->saveXML(null, LIBXML_NOEMPTYTAG);

Expected result:
IMHO null is reasonable value, meaning that whole document should be saved. I suggest to fix this backward compatibility break.

Actual result:
Catchable fatal error: Argument 1 passed to DOMDocument::saveXML() must be an instance of DOMNode, null given, called in ...\index.php on line 97 and defined in ...\inc.Menu.php on line 23


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-28 12:04 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Sun Nov 29 06:01:43 2015 UTC