xref: /PHP-7.2/ext/xml/tests/bug25666.phpt (revision 97200944)
1--TEST--
2Bug #25666 (XML namespaces broken in libxml-based SAX interface)
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 start_elem($parser,$name,$attribs) {
11	var_dump($name);
12}
13function end_elem()
14{
15}
16
17$xml = <<<HERE
18<foo:a xmlns:foo="http://example.com/foo"
19       xmlns:bar="http://example.com/bar"
20	   xmlns:baz="http://example.com/baz">
21  <bar:b />
22  <baz:c />
23</foo>
24HERE;
25
26$parser = xml_parser_create_ns("ISO-8859-1","@");
27xml_set_element_handler($parser,'start_elem','end_elem');
28xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
29xml_parse($parser, $xml);
30xml_parser_free($parser);
31?>
32--EXPECT--
33string(24) "http://example.com/foo@a"
34string(24) "http://example.com/bar@b"
35string(24) "http://example.com/baz@c"
36