Skip to content

Commit edf7346

Browse files
committed
Skip large ftruncate test if large files not supported
1 parent 6aa6d70 commit edf7346

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ext/standard/tests/file/ftruncate_bug76422.phpt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ if (false === $file_handle) {
1717
die('Cannot open test file :/');
1818
}
1919

20+
/* Check if ftruncate() with 2GB works. If it doesn't, it's likely that large files are
21+
* generally not supported (EFBIG). */
22+
$truncate_offset = 2 * 1024 * 1024 * 1024;
23+
$ftruncate_result = ftruncate($file_handle, $truncate_offset);
24+
if (false === $ftruncate_result) {
25+
var_dump(true);
26+
return;
27+
}
28+
2029
$truncate_offset = 4 * 1024 * 1024 * 1024 + 1;
2130
$ftruncate_result = ftruncate($file_handle, $truncate_offset);
2231

0 commit comments

Comments
 (0)