PHP 4.0 Bug #8363: XML parser dies if character_data_handler set
| From: | bill at rsv dot ricoh dot com | Date: | Thu, 21 Dec 2000 19:46:56 +0000 |
| Subject: | PHP 4.0 Bug #8363: XML parser dies if character_data_handler set | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-42074@lists.php.net to get a copy of this message | ||
From: bill@rsv.ricoh.com
Operating system: RH Linux 6.2
PHP version: 4.0.4
PHP Bug Type: XML related
Bug description: XML parser dies if character_data_handler set
The following test case originally came from the online docs, but most recently from the xml2tree
project I wrote (http://www.risource.org/phpTools/xml2tree/ ); two people have reported it broken
with the release of 4.0.4.
----------- configuration -----------------
./configure --with-mysql --with-apxs=/usr/local/apache/bin/apxs
----------- test case ---------
function characterData($parser, $data)
{
echo "in characterData got [$data]<br>";
}
$xml_parser = xml_parser_create();
// commment out the following line to prevent the crash
xml_set_character_data_handler($xml_parser, "characterData");
$xmlContent = "<mytag> <othertag> goo
</othertag><yuck>glumph</yuck></mytag>";
echo "before data<br>"; flush();
// 4.0.4 dies here, but only if character_data_handler is set;
// 4.0.3 is fine.
if (!xml_parse($xml_parser, $xmlContent, "yes" )) {
die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
echo "after data<br>"; flush();
xml_parser_free($xml_parser);
--
Edit Bug report at: http://bugs.php.net/?id=8363&edit=1