summaryrefslogtreecommitdiff
path: root/ext/xml/tests/bug35447.phpt
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2013-03-14 05:42:27 +0000
committer <>2013-04-03 16:25:08 +0000
commitc4dd7a1a684490673e25aaf4fabec5df138854c4 (patch)
tree4d57c44caae4480efff02b90b9be86f44bf25409 /ext/xml/tests/bug35447.phpt
downloadphp2-master.tar.gz
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/xml/tests/bug35447.phpt')
-rw-r--r--ext/xml/tests/bug35447.phpt49
1 files changed, 49 insertions, 0 deletions
diff --git a/ext/xml/tests/bug35447.phpt b/ext/xml/tests/bug35447.phpt
new file mode 100644
index 0000000..8cbb5e5
--- /dev/null
+++ b/ext/xml/tests/bug35447.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Bug #35447 (xml_parse_into_struct() chokes on the UTF-8 BOM)
+--SKIPIF--
+<?php
+require_once("skipif.inc");
+if (! @xml_parser_create_ns('ISO-8859-1')) { die("skip xml_parser_create_ns is not supported on this plattform");}
+?>
+--FILE--
+<?php
+$data = <<<END_OF_XML
+\xEF\xBB\xBF<?xml version="1.0" encoding="utf-8"?\x3e
+<!DOCTYPE bundle [
+ <!ELEMENT bundle (resource)+>
+ <!ELEMENT resource (#PCDATA)>
+ <!ATTLIST resource
+ key CDATA #REQUIRED
+ type (literal|pattern|sub) "literal"
+ >
+]>
+<resource key="rSeeYou">A bient&amp;244;t</resource>
+END_OF_XML;
+
+$parser = xml_parser_create_ns('UTF-8');
+xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
+$result = xml_parse_into_struct($parser, $data, $vals, $index);
+xml_parser_free($parser);
+var_dump($vals);
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ array(5) {
+ ["tag"]=>
+ string(8) "resource"
+ ["type"]=>
+ string(8) "complete"
+ ["level"]=>
+ int(1)
+ ["attributes"]=>
+ array(2) {
+ ["key"]=>
+ string(7) "rSeeYou"
+ ["type"]=>
+ string(7) "literal"
+ }
+ ["value"]=>
+ string(13) "A bient&244;t"
+ }
+}