php.net |  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: None
 [2008-09-28 10:09 UTC] zizka at seznam dot cz
Description:
------------
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-28 12:04 UTC] rrichards@php.net
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
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC