Bug #60792 [Com]: XML parser stops on multiple XML declarations

From: Date: Mon, 15 Feb 2016 00:40:01 +0000
Subject: Bug #60792 [Com]: XML parser stops on multiple XML declarations
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199207@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60792&edit=1 ID: 60792 Comment by: anrdaemon at freemail dot ru Reported by: Daniellehr at gmx dot de Summary: XML parser stops on multiple XML declarations Status: Open Type: Bug Package: *XML functions Operating System: Ubuntu PHP Version: 5.3.9 Block user comment: N Private report: N New Comment: This is an expected behavior. You must recreate the parser for a new document. Not. A. Bug. Previous Comments: ------------------------------------------------------------------------ [2012-01-18 14:29:13] Daniellehr at gmx dot de 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 this bug report at https://bugs.php.net/bug.php?id=60792&edit=1

« previous php.bugs (#199207) next »