php-src/ext/xml/tests/xml004.phpt
Pierre Joye bb1ec86f9d - remove magic_quotes_gpc, magic_quotes_runtime, magic_quotes_sybase
(calling ini_set('magic_....') returns 0|false
- get_magic_quotes_gpc, get_magic_quotes_runtime are kept but always return false
- set_magic_quotes_runtime raises an E_CORE_ERROR
2006-03-08 00:43:32 +00:00

63 lines
1.1 KiB
PHP

--TEST--
XML parser case folding test
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
<?php
chdir(dirname(__FILE__));
$xp = xml_parser_create();
xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
xml_set_element_handler($xp, "start_element", "end_element");
$fp = fopen("xmltest.xml", "r");
while ($data = fread($fp, 4096)) {
xml_parse($xp, $data, feof($fp));
}
xml_parser_free($xp);
$xp = xml_parser_create();
xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, true);
xml_set_element_handler($xp, "start_element", "end_element");
$fp = fopen("xmltest.xml", "r");
while ($data = fread($fp, 4096)) {
xml_parse($xp, $data, feof($fp));
}
xml_parser_free($xp);
function start_element($xp, $elem, $attribs)
{
print "<$elem";
if (sizeof($attribs)) {
while (list($k, $v) = each($attribs)) {
print " $k=\"$v\"";
}
}
print ">\n";
}
function end_element($xp, $elem)
{
print "</$elem>\n";
}
?>
--EXPECT--
<root id="elem1">
<elem1>
<elem2>
<elem3>
<elem4>
</elem4>
</elem3>
</elem2>
</elem1>
</root>
<ROOT ID="elem1">
<ELEM1>
<ELEM2>
<ELEM3>
<ELEM4>
</ELEM4>
</ELEM3>
</ELEM2>
</ELEM1>
</ROOT>