php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47137 LIBXML_NOXMLDECL is not working anymore
Submitted: 2009-01-17 13:58 UTC Modified: 2009-02-03 14:45 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: romain dot lalaut at laposte dot net Assigned:
Status: Not a bug Package: XML related
PHP Version: 5.3.0alpha3 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: romain dot lalaut at laposte dot net
New email:
PHP Version: OS:

 

 [2009-01-17 13:58 UTC] romain dot lalaut at laposte dot net
Description:
------------
It seems that saving a DOMDocument which is loaded with LIBXML_NOXMLDECL doesn't avoid to get the xml declaration.
It is a big problem to produce a xhtml document for internet because  IE6 is not dead yet.

Tested with libxml2 2.6.32 and 2.7.2

Reproduce code:
---------------
<?php
$xml = '<myxml/>';

$doc = new DOMDocument();
$doc->loadXml($xml, LIBXML_NOXMLDECL);

echo $doc->saveXML();

Expected result:
----------------
<myxml/>

Actual result:
--------------
<?xml version="1.0"?>
<myxml/>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-03 14:45 UTC] rrichards@php.net
That is a save option which hasn't yet been implemented so has never 
worked
 [2010-05-28 03:45 UTC] jpatokal at iki dot fi
This is not "bogus" at all.  See http://www.php.net/manual/en/libxml.constants.php:

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

From that, I'd expect saveXML to drop the XML declaration as promised, but it does not, so it's broken.  See also http://bugs.php.net/bug.php?id=50989.
 [2011-08-11 10:31 UTC] suit at rebell dot at
It is stoll not fixed and its very annoying, if you want to create XML documents without declaration. Bug #50989 works for me, but its still no satisfying solution.

Fix this either in PHP or at least in the Documentation.
 [2013-09-23 11:10 UTC] joscha at feth dot com
Is there any update on this issue?
 [2013-12-12 15:38 UTC] avillalbacasas at gmail dot com
Is there any update about this issue? If it doesn't work, and it will not work, please update the documentation since that it is a fake right now.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Mar 13 05:01:30 2025 UTC