xref: /PHP-8.1/ext/xml/tests/bug72714.phpt (revision 74859783)
1--TEST--
2Bug #72714 (_xml_startElementHandler() segmentation fault)
3--EXTENSIONS--
4xml
5--FILE--
6<?php
7function startElement($parser, $name, $attribs) {
8    var_dump($name);
9}
10
11function endElement($parser, $name) {}
12
13function parse($tagstart) {
14    $xml = '<ns1:total>867</ns1:total>';
15
16    $xml_parser = xml_parser_create();
17    xml_set_element_handler($xml_parser, 'startElement', 'endElement');
18
19    xml_parser_set_option($xml_parser, XML_OPTION_SKIP_TAGSTART, $tagstart);
20    xml_parse($xml_parser, $xml);
21
22    xml_parser_free($xml_parser);
23}
24
25parse(3015809298423721);
26parse(20);
27?>
28--EXPECTF--
29Warning: xml_parser_set_option(): tagstart ignored, because it is out of range in %s on line %d
30string(9) "NS1:TOTAL"
31string(0) ""
32