bug46699.phpt 845 B

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