bug35447.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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&amp;244;t</resource>
  21. END_OF_XML;
  22. $parser = xml_parser_create_ns('UTF-8');
  23. xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
  24. $result = xml_parse_into_struct($parser, $data, $vals, $index);
  25. xml_parser_free($parser);
  26. var_dump($vals);
  27. ?>
  28. --EXPECT--
  29. array(1) {
  30. [0]=>
  31. array(5) {
  32. ["tag"]=>
  33. string(8) "resource"
  34. ["type"]=>
  35. string(8) "complete"
  36. ["level"]=>
  37. int(1)
  38. ["attributes"]=>
  39. array(2) {
  40. ["key"]=>
  41. string(7) "rSeeYou"
  42. ["type"]=>
  43. string(7) "literal"
  44. }
  45. ["value"]=>
  46. string(13) "A bient&244;t"
  47. }
  48. }