-
Notifications
You must be signed in to change notification settings - Fork 7.8k
/
Copy pathbug81481.phpt
36 lines (34 loc) · 998 Bytes
/
bug81481.phpt
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
36
--TEST--
Bug #81481 (xml_get_current_byte_index limited to 32-bit numbers on 64-bit builds)
--CREDITS--
dev at b65sol dot com
--EXTENSIONS--
xml
--INI--
memory_limit=-1
--SKIPIF--
<?php
require __DIR__ . '/libxml_expat_skipif.inc';
skipif(want_expat: false);
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
if (PHP_INT_SIZE != 8) die("skip 64-bit only");
if (PHP_OS_FAMILY == 'Windows') die('skip not for Windows');
?>
--FILE--
<?php
$parser = xml_parser_create('UTF-8');
xml_set_element_handler( $parser, 'startelement', null );
$emptylong = str_repeat(' ', 1024*1024);
xml_parse($parser, '<root><i></i><b/><ext>Hello</ext>', false);
for($i = 0; $i < 2200; $i++) {
xml_parse($parser, $emptylong, false);
}
xml_parse($parser, '<ext></ext><ext></ext></root>', false);
function startelement($parser, $name, $attribute) {
if ( $name == 'EXT' ) { echo "Byte Index:", xml_get_current_byte_index($parser), "\n"; }
}
?>
--EXPECT--
Byte Index:21
Byte Index:2306867237
Byte Index:2306867248