Bug #55857 [Ana->Csd]: ftp_size on large files

From: Date: Tue, 23 Jun 2020 14:03:40 +0000
Subject: Bug #55857 [Ana->Csd]: ftp_size on large files
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227608@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=55857&edit=1 ID: 55857 Updated by: cmb@php.net Reported by: websupport at osite dot de Summary: ftp_size on large files -Status: Analyzed +Status: Closed Type: Bug Package: FTP related Operating System: Windows 64bit PHP Version: 7.3.0alpha4 Assigned To: cmb Block user comment: N Private report: N New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [2020-06-23 13:24:12] 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 ------------------------------------------------------------------------ [2018-07-23 15:41:30] 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> ------------------------------------------------------------------------ [2013-07-23 17:36:32] 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 ------------------------------------------------------------------------ [2013-07-23 16:48:58] 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]); } ------------------------------------------------------------------------ [2011-10-06 08:58:23] 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. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55857 -- Edit this bug report at https://bugs.php.net/bug.php?id=55857&edit=1

« previous php.bugs (#227608) next »