hhvm
hhvm copied to clipboard
Different behavior of the XML_OPTION_SKIP_WHITE option
[sanz@localhost hhvm]$ php --version
PHP 5.6.2 (cli) (built: Oct 16 2014 08:36:16)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
[sanz@localhost hhvm]$ hhvm --version
HipHop VM 3.4.0-dev (rel)
Compiler: heads/master-0-g9a587ba04d6ac4924b6cc3445455452d12853944
Repo schema: 30fbdfaa3bba08f05de929a221f6d6b0078d82a8
Extension API: 20140829
[sanz@localhost hhvm]$ cat test3.php
<?php
function read_xml($skip_white) {
$xml=file_get_contents("xml/test3.xml");
$parser=xml_parser_create();
xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,$skip_white);
xml_parser_set_option($parser,XML_OPTION_TARGET_ENCODING,"UTF-8");
$array=array();
$index=array();
xml_parse_into_struct($parser,$xml,$array,$index);
return $array;
}
function find_node($array,$node) {
foreach($array as $key=>$val) {
if($val["tag"]==$node) return $val;
}
return array();
}
// WITH XML_OPTION_SKIP_WHITE=0 WORKS FINE
$array=read_xml(0);
$node=find_node($array,"query");
print_r($node);
// WITH XML_OPTION_SKIP_WHITE=1 FAILS
$array=read_xml(1);
$node=find_node($array,"query");
print_r($node);
?>
[sanz@localhost hhvm]$ cat xml/test3.xml
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<query>a
b
c
d
e
f
g
h</query>
</root>
[sanz@localhost hhvm]$ php test3.php
Array
(
[tag] => query
[type] => complete
[level] => 2
[value] => a
b
c
d
e
f
g
h
)
Array
(
[tag] => query
[type] => complete
[level] => 2
[value] => a
b
c
d
e
f
g
h
)
[sanz@localhost hhvm]$ hhvm test3.php
Array
(
[tag] => query
[type] => complete
[level] => 2
[value] => a
b
c
d
e
f
g
h
)
Array
(
[tag] => query
[type] => complete
[level] => 2
[value] => a b cde f g h
)
I will look at it.
Thanks!!!
Hi hamidre13.
I have checked that the bug has been fixed. It's true???
Thanks in advance.
Josep.
Looks like it #4185. @hamidre13 for future reference if you put "Fixes #xxxx" in a line by itself in the summary it will close the issue for you.