1--TEST--
2Bug #76422 ftruncate fails on files > 2GB
3--SKIPIF--
4<?php
5if (PHP_INT_SIZE < 8) {
6    die('skip.. only valid for 64-bit');
7}
8?>
9--FILE--
10<?php
11
12$fn = dirname(__FILE__) . DIRECTORY_SEPARATOR . "test76422";
13
14$file_handle = fopen($fn,'cb');
15
16if (false === $file_handle) {
17    die('Cannot open test file :/');
18}
19
20$truncate_offset = 4 * 1024 * 1024 * 1024 + 1;
21$ftruncate_result = ftruncate($file_handle, $truncate_offset);
22
23if (false === $ftruncate_result) {
24    die('Truncate has failed :/');
25}
26
27fclose($file_handle);
28var_dump(filesize($fn) >= $truncate_offset);
29?>
30--CLEAN--
31<?php
32$fn = dirname(__FILE__) . "/test76422";
33unlink($fn);
34?>
35--EXPECT--
36bool(true)
37