Bug #76422 [Fbk->Asn]: ftruncate fails on files > 2GB
| From: | yani at iliev dot me | Date: | Thu, 07 Jun 2018 19:49:38 +0000 |
| Subject: | Bug #76422 [Fbk->Asn]: ftruncate fails on files > 2GB | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-215538@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
User updated by: yani at iliev dot me
Reported by: yani at iliev dot me
Summary: ftruncate fails on files > 2GB
-Status: Feedback
+Status: Assigned
Type: Bug
Package: Filesystem function related
Operating System: Windows 10 Pro x64
PHP Version: 7.2.6
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Yes, 64Bit build of PHP.
PHP_INT_SIZE is 8
Previous Comments:
------------------------------------------------------------------------
[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