|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23000 Multiple XML declarations in one document
Submitted: 2003-04-01 04:26 UTC Modified: 2003-04-01 06:28 UTC
From: raoul at nexus dot net dot nz Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 4.3.1 OS: RedHat 8.0 Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
5 + 11 = ?
Subscribe to this entry?

 [2003-04-01 04:26 UTC] raoul at nexus dot net dot nz
My configuration compile line is;
./configure' '--enable-ctype' '--with-xml' '--with-xmlrpc' '--enable-xslt' '--with-sablot-js' '--enable-xslt' '--with-xslt-sablot' '--with-dom' '--with-openssl' '--with-sockets' '--with-curl=../dependencies/curl-7.10.3' '--with-pgsql' '--with-mhash=../dependencies/mhash-0.8.18' '--with-ming' '--with-imap=../dependencies/imap-2002b' '--with-freetype-dir=../dependencies/freetype-2.1.4rc1' '--with-zlib-dir=../dependencies/zlib-1.1.4' '--with-gd' '--enable-gd-native-ttf' '--enable-gd-imgstrttf' '--with-jpeg-dir=/usr/lib' '--with-png-dir=/usr/lib' '--enable-mbstring' '--enable-mbstr-enc-trans' '--with-apxs'

The code that creates the bug;
	$doc = domxml_new_doc("1.0");
	$layoutsListNode = $doc->create_element('Response');
	$layoutsListNode->set_attribute('message', $message);
	$layoutsListNode->set_attribute('baseObject', $baseObject);
	$layoutsListNode = $doc->append_child($layoutsListNode);
	echo $doc->dump_mem());

The page that uses the above code serves mutiple requests from a Flash movie using XML over HTTP. Each time I call this page from my Flash movie the XML declaration gets repeated in the response back to the Flash client. The number of extra tags corresponds exactly with the number of requests done from the Flash movie during that Flash session. In theory each request is in a seperate HTTP request so I would have thought PHP and Flash would not have been able to do this.

It looks to me that Flash is keeping the HTTP session alive during is lifetime but for some reason PHP is getting a bit confused from client request to client request.

I have found a temporary work around but it is an ugly hack.
echo str_replace("<?xml version=\"1.0\"?>", "", $doc->dump_mem());

As Flash does not need the declaration tag, doesn't cause any harm here.

Any thoughts?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-01 06:28 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.


PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 25 17:01:30 2024 UTC