Bug #54735 [NEW]: xml_parse_into_struct gives uncomplete array
| From: | phpnet at phoen dot de | Date: | Sat, 14 May 2011 11:29:54 +0000 |
| Subject: | Bug #54735 [NEW]: xml_parse_into_struct gives uncomplete array | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-160729@lists.php.net to get a copy of this message | ||
From:
Operating system: Windows XPSP2
PHP version: 5.3.6
Package: *XML functions
Bug Type: Bug
Bug description:xml_parse_into_struct gives uncomplete array
Description:
------------
hi,
configuration: Windows XP with XAMPP 1.7.3 (nothing special)
xml_parse_into_struct returns an uncomplete array if there is an unexpected
sign(maybe utf8).
All after "â¬" in the array is missing. No error or messed up character
shows up.
It doesn't help to set any options.
$myxml=utf8_encode($myxml);
and afterwards
can fix the problem surprisingly.
thanks,H.
Test script:
---------------
<?php
$myxml="<XML><FELD1>blubb</FELD1><FELD2>dies hier sonderzeichen
â¬</FELD2><FELD3>feld3</FELD3></XML>";
$p = xml_parser_create();
xml_parse_into_struct($p, $myxml, $vals, $index);
xml_parser_free($p);
print_r($vals);
php?>
Expected result:
----------------
sth like this
Array ( [0] =>
Array ( [tag] => XML [type] => open [level] => 1 [value] => ) [1] => Array
( [tag] => FELD1 [type] => complete [level] => 2 [value] => blubb ) [2] =>
Array ( [tag] => XML [value] => [type] => cdata [level] => 1 ) [3] => Array
( [tag] => FELD2 [type] => complete [level] => 2 [value] => dies hier
sonderzeichen â¬) [3] => Array ( [tag] => XML [value] => [type] => cdata
[level] => 1 ) [3] => Array ( [tag] => FELD3 [type] => complete[level] => 2
[value] => feld3))
Actual result:
--------------
Array ( [0] =>
Array ( [tag] => XML [type] => open [level] => 1 [value] => ) [1] => Array
( [tag] => FELD1 [type] => complete [level] => 2 [value] => blubb ) [2] =>
Array ( [tag] => XML [value] => [type] => cdata [level] => 1 ) [3] => Array
( [tag] => FELD2 [type] => open [level] => 2 [value] => dies hier
sonderzeichen ) )
--
Edit bug report at http://bugs.php.net/bug.php?id=54735&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54735&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54735&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54735&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54735&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54735&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54735&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54735&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54735&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54735&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54735&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54735&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54735&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54735&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54735&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54735&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54735&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54735&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54735&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54735&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54735&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54735&r=mysqlcfg