xref: /PHP-5.3/ext/xml/tests/bug46699.phpt (revision ca954ad6)
1--TEST--
2Bug #46699: (xml_parse crash when parser is namespace aware)
3--SKIPIF--
4<?php
5require_once("skipif.inc");
6if (! @xml_parser_create_ns('ISO-8859-1')) { die("skip xml_parser_create_ns is not supported on this platform");}
7?>
8--FILE--
9<?php
10function defaultfunc($parser, $data)
11{
12echo $data;
13}
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>
21HERE;
22
23$parser = xml_parser_create_ns("ISO-8859-1","@");
24xml_set_default_handler($parser,'defaultfunc');
25xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
26xml_parse($parser, $xml);
27xml_parser_free($parser);
28?>
29--EXPECT--
30<a xmlns="http://example.com/foo" xmlns:bar="http://example.com/bar">
31  <bar:b foo="bar">1</bar:b>
32  <bar:c bar:nix="null" foo="bar">2</bar:c>
33</a>
34