You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<?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
)
The text was updated successfully, but these errors were encountered:
[sanz@localhost hhvm]$ php --version
[sanz@localhost hhvm]$ hhvm --version
[sanz@localhost hhvm]$ cat test3.php
[sanz@localhost hhvm]$ cat xml/test3.xml
[sanz@localhost hhvm]$ php test3.php
[sanz@localhost hhvm]$ hhvm test3.php
The text was updated successfully, but these errors were encountered: