Bug #76422 [Asn->Csd]: ftruncate fails on files > 2GB

From: Date: Sat, 09 Jun 2018 09:32:47 +0000
Subject: Bug #76422 [Asn->Csd]: ftruncate fails on files > 2GB
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-215556@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76422&edit=1 ID: 76422 Updated by: ab@php.net Reported by: yani at iliev dot me Summary: ftruncate fails on files > 2GB -Status: Assigned +Status: Closed Type: Bug Package: Filesystem function related Operating System: Windows 10 Pro x64 PHP Version: 7.2.6 Assigned To: ab Block user comment: N Private report: N New Comment: Automatic comment on behalf of ab Revision: http://git.php.net/?p=php-src.git;a=commit;h=9cd2d77514aa71359eac0ea080901e7c021681c9 Log: Fixed bug #76422 ftruncate fails on files &gt; 2GB Previous Comments: ------------------------------------------------------------------------ [2018-06-07 19:49:37] yani at iliev dot me Yes, 64Bit build of PHP. PHP_INT_SIZE is 8 ------------------------------------------------------------------------ [2018-06-07 16:49:58] cmb@php.net Do you actually use a 64bit build? ------------------------------------------------------------------------ [2018-06-07 05:23:20] yani at iliev dot me Description: ------------ ftruncate returns false when the file being truncated is > 2GB and the offset is also > 2GB. This only occurs on Windows and not on Linux/Mac Test script: --------------- <?php $file_handle = fopen('test','cb'); if (false === $file_handle) { die('Cannot open test file :/'); } $truncate_offset = 2 * 1024 * 1024 * 1024 + 1; // 2GB + 1 $ftruncate_result = ftruncate($file_handle, $truncate_offset); if (false === $ftruncate_result) { die('Truncate has failed :/'); } fclose($file_handle); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76422&edit=1

« previous php.bugs (#215556) next »