From: chrivers at iversen-net dot dk Operating system: Linux 2.6.5, Debian Sarge PHP version: 5.0.2 PHP Bug Type: XML related Bug description: Behaviour change in SAX causes breakage from php4 -> php5
Description: ------------ When converting my pages to PHP5 SAX XML parser, they broke because of an appearant incompatability. The chardata-handler is called in a different pattern that in PHP4. Before, it seemed to be called once per character block. Now, the buffer is flushed before each block of high-bit characters, it seems. This is unexpected and (seemingly?) impossible to change. Reproduce code: --------------- <? function es() {} function ee() {} function cd($P, $D) {print "[$D]\n";} # $str = "UTF:æøå:UTF"; $strenc = "utf-8"; $str = "ISO:æøå:ISO"; $strenc = "iso-8859-1"; $buffer = "<?xml version=\"1.0\" encoding=\"$strenc\"?><global>$str</global>"; $xml_parser = xml_parser_create(); # xml_set_element_handler($xml_parser, "es", "ee"); xml_set_character_data_handler($xml_parser, "cd"); xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, true); xml_parser_set_option($xml_parser, XML_OPTION_TARGET_ENCODING, "iso-8859-1"); If (xml_parse($xml_parser, $buffer) == false) die(sprintf("TV import error: %s at line %d col %d\n%s", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser), xml_get_current_column_number($xml_parser), $buffer)); xml_parser_free($xml_parser); ?> Expected result: ---------------- expected: [ISO:æøå:ISO] php4: [ISO:æøå:ISO] Actual result: -------------- [ISO:] [æøå:ISO] -- Edit bug report at http://bugs.php.net/?id=30692&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30692&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30692&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30692&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30692&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30692&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30692&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30692&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30692&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30692&r=support Expected behavior: http://bugs.php.net/fix.php?id=30692&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30692&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30692&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30692&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30692&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30692&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30692&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30692&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30692&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30692&r=mysqlcfg