php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67387 SimpleXMLElement asXML() and saveXML() ignore LIBXML_NOXMLDECL
Submitted: 2014-06-05 13:57 UTC Modified: 2016-10-14 15:27 UTC
Votes:21
Avg. Score:3.5 ± 1.0
Reproduced:19 of 19 (100.0%)
Same Version:3 (15.8%)
Same OS:10 (52.6%)
From: anthon at piwik dot org Assigned:
Status: Open Package: SimpleXML related
PHP Version: 5.5.13 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-06-05 13:57 UTC] anthon at piwik dot org
Description:
------------
asXML() and saveXML() includes the XML declaration contrary to http://ca3.php.net/manual/en/libxml.constants.php

LIBXML_NOXMLDECL (integer)
Drop the XML declaration when saving a document

(#50989 is similar to this bug but was reported for DOMDocument.)

Test script:
---------------
<?php
$xml = new \SimpleXMLElement('<root/>', LIBXML_NOXMLDECL);
var_dump($xml->asXML());

Expected result:
----------------
string(8) "<root/>
"


Actual result:
--------------
string(30) "<?xml version="1.0"?>
<root/>
"


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-10-14 15:27 UTC] cmb@php.net
Related to bug #50989.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Mar 23 15:01:26 2019 UTC