File: bug72714.phpt

package info (click to toggle)
php8.4 8.4.11-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 208,108 kB
  • sloc: ansic: 1,060,628; php: 35,345; sh: 11,866; cpp: 7,201; pascal: 4,913; javascript: 3,091; asm: 2,810; yacc: 2,411; makefile: 689; xml: 446; python: 301; awk: 148
file content (35 lines) | stat: -rw-r--r-- 863 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
--TEST--
Bug #72714 (xml_startElementHandler() segmentation fault)
--EXTENSIONS--
xml
--SKIPIF--
<?php
if (PHP_INT_SIZE < 8) die('skip this test is for 64bit builds only');
?>
--FILE--
<?php
function startElement($parser, $name, $attribs) {
    var_dump($name);
}

function endElement($parser, $name) {}

function parse($tagstart) {
    $xml = '<ns1:total>867</ns1:total>';

    $xml_parser = xml_parser_create();
    xml_set_element_handler($xml_parser, 'startElement', 'endElement');

    xml_parser_set_option($xml_parser, XML_OPTION_SKIP_TAGSTART, $tagstart);
    xml_parse($xml_parser, $xml);

    xml_parser_free($xml_parser);
}

parse(3015809298423721);
parse(20);
?>
--EXPECTF--
Warning: xml_parser_set_option(): Argument #3 ($value) must be between 0 and 2147483647 for option XML_OPTION_SKIP_TAGSTART in %s on line %d
string(9) "NS1:TOTAL"
string(0) ""