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