mirror of
https://github.com/php/php-src.git
synced 2024-11-25 02:44:58 +08:00
03e656bc05
fix a couple warnings add test
34 lines
845 B
PHP
34 lines
845 B
PHP
--TEST--
|
|
Bug #46699: (xml_parse crash when parser is namespace aware)
|
|
--SKIPIF--
|
|
<?php
|
|
require_once("skipif.inc");
|
|
if (! @xml_parser_create_ns('ISO-8859-1')) { die("skip xml_parser_create_ns is not supported on this platform");}
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
function defaultfunc($parser, $data)
|
|
{
|
|
echo $data;
|
|
}
|
|
|
|
$xml = <<<HERE
|
|
<a xmlns="http://example.com/foo"
|
|
xmlns:bar="http://example.com/bar">
|
|
<bar:b foo="bar">1</bar:b>
|
|
<bar:c bar:nix="null" foo="bar">2</bar:c>
|
|
</a>
|
|
HERE;
|
|
|
|
$parser = xml_parser_create_ns("ISO-8859-1","@");
|
|
xml_set_default_handler($parser,'defaultfunc');
|
|
xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
|
|
xml_parse($parser, $xml);
|
|
xml_parser_free($parser);
|
|
?>
|
|
--EXPECT--
|
|
<a xmlns="http://example.com/foo" xmlns:bar="http://example.com/bar">
|
|
<bar:b foo="bar">1</bar:b>
|
|
<bar:c bar:nix="null" foo="bar">2</bar:c>
|
|
</a>
|