xref: /PHP-7.0/ext/standard/tests/file/bug39673.phpt (revision 60bb4946)
1--TEST--
2Bug #39673 (file_get_contents causes bus error on certain offsets)
3--FILE--
4<?php
5
6$str = str_repeat("test", 3456);
7
8$filename = dirname(__FILE__).'/bug39673.txt';
9file_put_contents($filename, $str);
10
11$offsets = array(
12	-1,
13	0,
14	3456*4,
15	3456*4 - 1,
16	3456*4 + 1,
17	2000,
18	5000,
19	100000,
20);
21
22
23foreach ($offsets as $offset) {
24	$r = file_get_contents($filename, false, null, $offset);
25	var_dump(strlen($r));
26}
27
28@unlink($filename);
29echo "Done\n";
30?>
31--EXPECTF--
32int(13824)
33int(13824)
34int(0)
35int(1)
36int(0)
37int(11824)
38int(8824)
39int(0)
40Done
41