#30529 [Bgs]: ftp_size() does not return values larger than 2^31

From: Date: Fri, 22 Oct 2004 11:25:15 +0000
Subject: #30529 [Bgs]: ftp_size() does not return values larger than 2^31
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-67948@lists.php.net to get a copy of this message
 ID:               30529
 Updated by:       derick@php.net
 Reported By:      wittj at gmx dot net
 Status:           Bogus
 Bug Type:         FTP related
 Operating System: linux-2.6.8-ck4
 PHP Version:      5.0.2
 New Comment:

Because it won't be accurate anymore due to you can not store the
precision you want in a float. 


Previous Comments:
------------------------------------------------------------------------

[2004-10-22 13:11:59] wittj at gmx dot net

Sorry, I did not know that. I mean, I did know that ints on my system
are limited to 32 bits (31 plus sign), but I always thought that php
could handle numbers larger than that. Maybe a silly question: why
does

$number = 4190578688;
print $number."<br/>";
print $number + 10;

work then? With var_dump() I see that $number is treated as a float
value. Why can't ftp_size() just return a float then?
Not being able to recognize files larger than 2GB seems somewhat dated
to me. No offense - I just wonder why this doesn't work. Thank you.

------------------------------------------------------------------------

[2004-10-22 12:50:48] derick@php.net

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php

PHP does not support numbers > 2^31 at this moment.

------------------------------------------------------------------------

[2004-10-22 12:18:37] wittj at gmx dot net

Description:
------------
On my FTP server I have a file which is about 4GB large. The FTP server
(vsftpd) reports the file size correctly (checked with sniffer), however
ftp_size() does only return a size of 2147483647 (2^31) bytes. Obviously
ftp_size() does not support files larger than that, as I get the same
result on other large files.

Reproduce code:
---------------
$conn_id = ftp_connect($server);
$contents = ftp_nlist($conn_id, ".");
foreach($contents as $file) {
  print ftp_size($conn_id, $file);
}

Expected result:
----------------
The correct file size

Actual result:
--------------
A file size of 2^31 bytes.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=30529&edit=1


Thread (5 messages)

« previous php.bugs (#67948) next »