Bug #76422 [Opn->Fbk]: ftruncate fails on files > 2GB

From: Date: Thu, 07 Jun 2018 16:49:59 +0000
Subject: Bug #76422 [Opn->Fbk]: ftruncate fails on files > 2GB
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-215535@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: cmb@php.net Reported by: yani at iliev dot me Summary: ftruncate fails on files > 2GB -Status: Open +Status: Feedback Type: Bug Package: Filesystem function related Operating System: Windows 10 Pro x64 PHP Version: 7.2.6 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Do you actually use a 64bit build? Previous Comments: ------------------------------------------------------------------------ [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 (#215535) next »