|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-10-07 04:13 UTC] aharvey@php.net
-Status: Open
+Status: Feedback
-Package: Systems problem
+Package: XML related
[2010-10-07 04:13 UTC] aharvey@php.net
[2010-10-18 21:47 UTC] andre dot boily at mcccf dot gouv dot qc dot ca
[2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 01:00:02 2025 UTC |
Description: ------------ Running version: 5.2.14 After a lot of tests and reading, I experimenting a problem since we've upgraded the PHP version from 5.2.6 to 5.2.14 The problem is when i'm trying to put a xml string in a array, i'm loosing the amperstamp (&)characters in the output of xml_parse_into_struct function. Maybe it's a new features that I can't understand, but it look like a Bug. Note: The Bug is in the URL tag in my XML structure. Test script: --------------- <?php $xmlValues = array(); $xmlIndex = array(); $parser = xml_parser_create(""); // Case management option xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, 1 ); // White space management option xml_parser_set_option( $parser, XML_OPTION_SKIP_WHITE, 0 ); xml_parser_set_option( $parser, XML_OPTION_TARGET_ENCODING, "UTF-8" ); $data = "<?xml version='1.0' encoding='utf-8'?><COLLECTION><DOCUMENT><TITRE>Some Title</TITRE><URL>http://www.test.com?param1=1&param2=2</URL><DATE>1285352820</DATE></DOCUMENT></COLLECTION>"; xml_parse_into_struct( $parser, $data, $xmlValues, $xmlIndex ); var_dump($xmlValues); ?> Expected result: ---------------- array(6) { [0]=> array(3) { ["tag"]=> string(10) "COLLECTION" ["type"]=> string(4) "open" ["level"]=> int(1) } [1]=> array(3) { ["tag"]=> string(8) "DOCUMENT" ["type"]=> string(4) "open" ["level"]=> int(2) } [2]=> array(4) { ["tag"]=> string(5) "TITRE" ["type"]=> string(8) "complete" ["level"]=> int(3) ["value"]=> string(10) "Some Title" } [3]=> array(4) { ["tag"]=> string(3) "URL" ["type"]=> string(8) "complete" ["level"]=> int(3) ["value"]=> string(36) "http://www.test.com?param1=1&param2=2" } [4]=> array(3) { ["tag"]=> string(8) "DOCUMENT" ["type"]=> string(5) "close" ["level"]=> int(2) } [5]=> array(3) { ["tag"]=> string(10) "COLLECTION" ["type"]=> string(5) "close" ["level"]=> int(1) } } Actual result: -------------- array(6) { [0]=> array(3) { ["tag"]=> string(10) "COLLECTION" ["type"]=> string(4) "open" ["level"]=> int(1) } [1]=> array(3) { ["tag"]=> string(8) "DOCUMENT" ["type"]=> string(4) "open" ["level"]=> int(2) } [2]=> array(4) { ["tag"]=> string(5) "TITRE" ["type"]=> string(8) "complete" ["level"]=> int(3) ["value"]=> string(10) "Some Title" } [3]=> array(4) { ["tag"]=> string(3) "URL" ["type"]=> string(8) "complete" ["level"]=> int(3) ["value"]=> string(36) "http://www.test.com?param1=1param2=2" } [4]=> array(3) { ["tag"]=> string(8) "DOCUMENT" ["type"]=> string(5) "close" ["level"]=> int(2) } [5]=> array(3) { ["tag"]=> string(10) "COLLECTION" ["type"]=> string(5) "close" ["level"]=> int(1) } }