|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-08-15 22:49 UTC] rrichards@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 14:00:01 2025 UTC |
Description: ------------ When xml_parse_into_struct reaches a unicode character (i.e an umlaut) when in a CDATA array element.It will split the text across two elements the second starting with that character. Reproduce code: --------------- <?php header('Content-type: text/html; charset=utf-8'); $input=<<<END <p>s?me p tag <b>s?me text</b> a bit more ?f the p t?g</p> END; print "<html><body><pre><xmp>"; //either save this example in UTF-8 form, or enable the follwing line //$input=utf8_encode($input); $parser = xml_parser_create('utf-8'); xml_parse_into_struct($parser, $input, $vals, $index); print_r($vals); print "</xmp></pre></body></html>"; ?> Expected result: ---------------- Array ( [0] => Array ( [tag] => P [type] => open [level] => 1 [value] => s?me p tag ) [1] => Array ( [tag] => B [type] => complete [level] => 2 [value] => s?me text ) [2] => Array ( [tag] => P [value] => a bit more ?f the p t?g [type] => cdata [level] => 1 ) [4] => Array ( [tag] => P [type] => close [level] => 1 ) ) Actual result: -------------- Array ( [0] => Array ( [tag] => P [type] => open [level] => 1 [value] => s?me p tag ) [1] => Array ( [tag] => B [type] => complete [level] => 2 [value] => s?me text ) [2] => Array ( [tag] => P [value] => a bit more [type] => cdata [level] => 1 ) [3] => Array ( [tag] => P [value] => ?f the p t?g [type] => cdata [level] => 1 ) [4] => Array ( [tag] => P [type] => close [level] => 1 ) )