From:
Operating system: Ubuntu
PHP version: 5.3.9
Package: *XML functions
Bug Type: Bug
Bug description:XML parser stops on multiple XML declarations
Description:
------------
I am working with socket streams and the XMPP protocol.
In a while it happens that a connection has to be replaced with a new one.
This can be done with sending the root node again to the server, and the
server
then replies with a new root node too.
This root node includes the XML declaration (<?xml ... ?>), but apparently
the
parser seems to stop at that point, where a new XML declaration occurs.
So I have to filter those strings out manually, that's not the expected
behavior
I wished to have.
This has been tested with PHP 5.3.5 and 5.3.9
Test script:
---------------
<?php
$p = xml_parser_create();
xml_set_element_handler($p, 'open', 'close');
function open($p, $tag) {
echo "opened tag $tag\n";
}
function close($p, $tag) {
echo "closed tag $tag\n";
}
$xml = "<?xml version='1.0' ?><stream><tag></tag>";
$xml2 = '</stream>';
xml_parse($p, $xml);
xml_parse($p, $xml);
xml_parse($p, $xml2);
Expected result:
----------------
opened tag STREAM
opened tag TAG
closed tag TAG
opened tag STREAM
opened tag TAG
closed tag TAG
closed tag STREAM
Actual result:
--------------
opened tag STREAM
opened tag TAG
closed tag TAG
--
Edit bug report at https://bugs.php.net/bug.php?id=60792&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=60792&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=60792&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=60792&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=60792&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=60792&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=60792&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=60792&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=60792&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=60792&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=60792&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=60792&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=60792&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=60792&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=60792&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=60792&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=60792&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=60792&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=60792&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=60792&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=60792&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=60792&r=mysqlcfg