#23631 [NEW]: xml_set_character_data_handler function called multiple times on one element

From: Date: Wed, 14 May 2003 21:08:50 +0000
Subject: #23631 [NEW]: xml_set_character_data_handler function called multiple times on one element
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-39667@lists.php.net to get a copy of this message
From: mrowe at pointsystems dot com Operating system: Win2k/RedHat Linux PHP version: 4.3.1 PHP Bug Type: XML related Bug description: xml_set_character_data_handler function called multiple times on one element Hi there, This may be a documentation issue, or an undocumented "feature." When I parse some elements, the "character data handler" may get called multiple times. Example: // start code // $xml = '<URL>http://www.php.net?a=1&amp;b=2&amp;c=3</URL>'; echo "xml = " . $xml . "\n\n"; $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterData"); function startElement($parser, $tag, $attributes){ } function endElement($parser, $tag){ } function characterData($parser, $cdata){ if (!trim($cdata)) return; echo "data = " . $cdata . "\n"; } if (!xml_parse($xml_parser, $xml, true)){ echo "not parsed"; } // end code // The results are: data = http://slashdot.org?a=1 data = & data = b=2 data = & data = c=3 I'm expecting: data = http://www.php.net?a=1&amp;b=2&amp;c=3 The online docs state "The second parameter, data, contains the character data as a string." However, in each case, "data" is only PART of the character data. -- Edit bug report at http://bugs.php.net/?id=23631&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=23631&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=23631&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=23631&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=23631&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=23631&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=23631&r=support Expected behavior: http://bugs.php.net/fix.php?id=23631&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=23631&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=23631&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=23631&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23631&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=23631&r=dst IIS Stability: http://bugs.php.net/fix.php?id=23631&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=23631&r=gnused

« previous php.bugs (#39667) next »