Bug #76422 [NEW]: ftruncate fails on files > 2GB
| From: | yani at iliev dot me | Date: | Thu, 07 Jun 2018 05:23:26 +0000 |
| Subject: | Bug #76422 [NEW]: ftruncate fails on files > 2GB | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-215527@lists.php.net to get a copy of this message | ||
From: yani at iliev dot me
Operating system: Windows 10 Pro x64
PHP version: 7.2.6
Package: Filesystem function related
Bug Type: Bug
Bug description:ftruncate fails on files > 2GB
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 bug report at https://bugs.php.net/bug.php?id=76422&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76422&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76422&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76422&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76422&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76422&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76422&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76422&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76422&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76422&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76422&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76422&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76422&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76422&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76422&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76422&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76422&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76422&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76422&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76422&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76422&r=mysqlcfg