Annotation of embedaddon/php/ext/xml/tests/bug35447.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #35447 (xml_parse_into_struct() chokes on the UTF-8 BOM)
3: --SKIPIF--
4: <?php
5: require_once("skipif.inc");
6: if (! @xml_parser_create_ns('ISO-8859-1')) { die("skip xml_parser_create_ns is not supported on this plattform");}
7: ?>
8: --FILE--
9: <?php
10: $data = <<<END_OF_XML
11: \xEF\xBB\xBF<?xml version="1.0" encoding="utf-8"?\x3e
12: <!DOCTYPE bundle [
13: <!ELEMENT bundle (resource)+>
14: <!ELEMENT resource (#PCDATA)>
15: <!ATTLIST resource
16: key CDATA #REQUIRED
17: type (literal|pattern|sub) "literal"
18: >
19: ]>
20: <resource key="rSeeYou">A bient&244;t</resource>
21: END_OF_XML;
22:
23: $parser = xml_parser_create_ns('UTF-8');
24: xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
25: $result = xml_parse_into_struct($parser, $data, $vals, $index);
26: xml_parser_free($parser);
27: var_dump($vals);
28: ?>
29: --EXPECT--
30: array(1) {
31: [0]=>
32: array(5) {
33: ["tag"]=>
34: string(8) "resource"
35: ["type"]=>
36: string(8) "complete"
37: ["level"]=>
38: int(1)
39: ["attributes"]=>
40: array(2) {
41: ["key"]=>
42: string(7) "rSeeYou"
43: ["type"]=>
44: string(7) "literal"
45: }
46: ["value"]=>
47: string(13) "A bient&244;t"
48: }
49: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>