Bug #52987 [Fbk->NoF]: Losing amperstamp with xml_parse_into_struct function
| From: | php-bugs at lists dot php dot net | Date: | Mon, 18 Feb 2013 00:34:30 +0000 |
| Subject: | Bug #52987 [Fbk->NoF]: Losing amperstamp with xml_parse_into_struct function | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-176914@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=52987&edit=1
ID: 52987
Updated by: php-bugs@lists.php.net
Reported by: andre dot boily at mcccf dot gouv dot qc dot ca
Summary: Losing amperstamp with xml_parse_into_struct function
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: XML related
Operating System: Linux - SUSE
PHP Version: 5.2.14
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2010-10-18 21:47:21] andre dot boily at mcccf dot gouv dot qc dot ca
I saw in the snapshot you've send me, the BUG is corrected in version 2.5.15.
- Fixed bug #45996 (libxml2 2.7 causes breakage with character data in
xml_parse()). (Rob)
Thanx!
------------------------------------------------------------------------
[2010-10-07 04:13:02] aharvey@php.net
Please try using this snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Works as expected for me on a current 5.2 build: the relevant bit of
output is:
[3]=>
array(4) {
["tag"]=>
string(3) "URL"
["type"]=>
string(8) "complete"
["level"]=>
int(3)
["value"]=>
string(37) "http://www.test.com?param1=1¶m2=2"
}
Note the decoded ampersand in the value.
------------------------------------------------------------------------
[2010-10-04 22:05:58] andre dot boily at mcccf dot gouv dot qc dot ca
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) } }
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=52987&edit=1