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