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

Reply via email to