From edf7346810292967f41e60fb1474e09e1558862d Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 24 Oct 2019 14:32:11 +0200 Subject: [PATCH] Skip large ftruncate test if large files not supported --- ext/standard/tests/file/ftruncate_bug76422.phpt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ext/standard/tests/file/ftruncate_bug76422.phpt b/ext/standard/tests/file/ftruncate_bug76422.phpt index 4f434d324a..77334545a9 100644 --- a/ext/standard/tests/file/ftruncate_bug76422.phpt +++ b/ext/standard/tests/file/ftruncate_bug76422.phpt @@ -17,6 +17,15 @@ if (false === $file_handle) { die('Cannot open test file :/'); } +/* Check if ftruncate() with 2GB works. If it doesn't, it's likely that large files are + * generally not supported (EFBIG). */ +$truncate_offset = 2 * 1024 * 1024 * 1024; +$ftruncate_result = ftruncate($file_handle, $truncate_offset); +if (false === $ftruncate_result) { + var_dump(true); + return; +} + $truncate_offset = 4 * 1024 * 1024 * 1024 + 1; $ftruncate_result = ftruncate($file_handle, $truncate_offset); -- 2.40.0