1
0
mirror of https://github.com/php/php-src.git synced 2026-04-11 18:13:00 +02:00
Files
archived-php-src/ext/xml/tests/bug73135.phpt
Christoph M. Becker 15e5cf856a Fix return value of xml_parse(_into_struct) for recursive parsing
As of PHP 8.0.0, these functions are supposed to return int, so we
cannot return `false`.  Since calling the parser recursively is a
programmer error, we throw an `Error` in this case.

Cf. <https://github.com/php/php-src/pull/7363>.
2021-08-13 19:00:13 +02:00

27 lines
609 B
PHP

--TEST--
Bug #73135 (xml_parse() segmentation fault)
--SKIPIF--
<?php if (!extension_loaded('xml')) die('skip xml extension not loaded'); ?>
--CREDITS--
edgarsandi - <edgar.r.sandi@gmail.com>
--FILE--
<?php
function start_elem($parser, $xml) {
xml_parse($parser, $xml);
}
$xml = <<<HERE
<a xmlns="ahihi">
<bar foo="ahihi"/>
</a>
HERE;
$parser = xml_parser_create_ns();
xml_set_element_handler($parser, 'start_elem', 'ahihi');
xml_parse($parser, $xml);
?>
--EXPECTF--
Fatal error: Uncaught Error: Parser must not be called recursively in %s:%d
Stack trace:
%a