xref: /PHP-8.3/ext/xml/tests/bug72714.phpt (revision 81e59c64)
1--TEST--
2Bug #72714 (_xml_startElementHandler() segmentation fault)
3--EXTENSIONS--
4xml
5--SKIPIF--
6<?php
7if (PHP_INT_SIZE < 8) die('skip this test is for 64bit builds only');
8?>
9--FILE--
10<?php
11function startElement($parser, $name, $attribs) {
12    var_dump($name);
13}
14
15function endElement($parser, $name) {}
16
17function parse($tagstart) {
18    $xml = '<ns1:total>867</ns1:total>';
19
20    $xml_parser = xml_parser_create();
21    xml_set_element_handler($xml_parser, 'startElement', 'endElement');
22
23    xml_parser_set_option($xml_parser, XML_OPTION_SKIP_TAGSTART, $tagstart);
24    xml_parse($xml_parser, $xml);
25
26    xml_parser_free($xml_parser);
27}
28
29parse(3015809298423721);
30parse(20);
31?>
32--EXPECTF--
33Warning: xml_parser_set_option(): Argument #3 ($value) must be between 0 and 2147483647 for option XML_OPTION_SKIP_TAGSTART in %s on line %d
34string(9) "NS1:TOTAL"
35string(0) ""
36