From:             raoul at nexus dot net dot nz
Operating system: RedHat 8.0 Linux
PHP version:      4.3.1
PHP Bug Type:     DOM XML related
Bug description:  Multiple XML declarations in one document

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?
-- 
Edit bug report at http://bugs.php.net/?id=23000&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=23000&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=23000&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=23000&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=23000&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=23000&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=23000&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=23000&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=23000&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=23000&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=23000&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23000&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=23000&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=23000&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=23000&r=gnused

Reply via email to