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