php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55857 ftp_size on large files
Submitted: 2011-10-06 07:54 UTC Modified: 2020-06-23 13:14 UTC
Votes:9
Avg. Score:3.0 ± 0.8
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: websupport at osite dot de Assigned: cmb (profile)
Status: Closed Package: FTP related
PHP Version: 7.3.0alpha4 OS: Windows 64bit
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: websupport at osite dot de
New email:
PHP Version: OS:

 

 [2011-10-06 07:54 UTC] websupport at osite dot de
Description:
------------
ftp_size does not work on large files > 2gb event not on 64bit systems
can be fixed with the following patch



Patches

ftp_size_large_file (last revision 2011-10-06 07:55 UTC by websupport at osite dot de)

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-10-06 08:58 UTC] pajoye@php.net
-Status: Open +Status: Analyzed
 [2011-10-06 08:58 UTC] pajoye@php.net
It depends on the underlying API used for the network operations, the php's stream 
implementation.

PHP's stream does not support yet LFS and cannot support it easily by only using 
long instead of int (while this breaks the api signature too).

Suspended until we have lfs support.
 [2013-07-23 16:48 UTC] daltoncaughell at gmail dot com
Stumbled across this issue just thought I would toss in my solution. Just queries 
the ftp server for the size and converts the resulting string to a double rather 
than an int.

$size = 0;
$result = ftp_raw($conn_id, "SIZE " . <file path>);
$parts = explode(" ", $result[0]);
if($parts[0] === "213") {
    $size = doubleval($parts[1]);
}
 [2013-07-23 17:36 UTC] lang at b1-systems dot de
The suggested patch uses long instead. 

Double is not a good value for file sizes as discussed here: https://bugs.php.net/bug.php?id=44522  https://github.com/php/php-src/pull/372
 [2018-07-23 15:41 UTC] cmb@php.net
-Operating System: linux +Operating System: Windows 64bit -PHP Version: 5.3.8 +PHP Version: 7.3.0alpha4
 [2018-07-23 15:41 UTC] cmb@php.net
This is fixed for 64bit POSIX systems as of PHP 5.4.20[1], and is
unlikely to get fixed for 32bit systems.  However, it won't work
for 64bit Windows, since the function uses atol()[2] which returns
a long.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=a93a462>
[2] <https://github.com/php/php-src/blob/php-7.2.8/ext/ftp/ftp.c#L1144>
 [2020-06-23 13:14 UTC] cmb@php.net
-Type: Feature/Change Request +Type: Bug -Assigned To: +Assigned To: cmb
 [2020-06-23 13:24 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix #55857: ftp_size on large files
On GitHub:  https://github.com/php/php-src/pull/5757
Patch:      https://github.com/php/php-src/pull/5757.patch
 [2020-06-23 14:03 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e94126aac74a80749c7bcf00f5faa9ad9542c94b
Log: Fix #55857: ftp_size on large files
 [2020-06-23 14:03 UTC] cmb@php.net
-Status: Analyzed +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 16:01:30 2024 UTC