bug46699.phpt 836 B

12345678910111213141516171819202122232425262728293031323334
  1. --TEST--
  2. Bug #46699: (xml_parse crash when parser is namespace aware)
  3. --EXTENSIONS--
  4. xml
  5. --SKIPIF--
  6. <?php
  7. if (! @xml_parser_create_ns('ISO-8859-1')) { die("skip xml_parser_create_ns is not supported on this platform");}
  8. ?>
  9. --FILE--
  10. <?php
  11. function defaultfunc($parser, $data)
  12. {
  13. echo $data;
  14. }
  15. $xml = <<<HERE
  16. <a xmlns="http://example.com/foo"
  17. xmlns:bar="http://example.com/bar">
  18. <bar:b foo="bar">1</bar:b>
  19. <bar:c bar:nix="null" foo="bar">2</bar:c>
  20. </a>
  21. HERE;
  22. $parser = xml_parser_create_ns("ISO-8859-1","@");
  23. xml_set_default_handler($parser,'defaultfunc');
  24. xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
  25. xml_parse($parser, $xml);
  26. xml_parser_free($parser);
  27. ?>
  28. --EXPECT--
  29. <a xmlns="http://example.com/foo" xmlns:bar="http://example.com/bar">
  30. <bar:b foo="bar">1</bar:b>
  31. <bar:c bar:nix="null" foo="bar">2</bar:c>
  32. </a>