Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.4.0a3

Bug #10237 put doesn't run ftp_alloc to allocate space
Submitted: 2007-03-01 14:12 UTC Modified: 2007-11-24 14:50 UTC
From: mwillbanks Assigned: jorrit
Status: Closed Package: Net_FTP (version CVS)
PHP Version: 5.2.1 OS: Linux
Roadmaps: 1.3.3    
Subscription  


 [2007-03-01 14:12 UTC] mwillbanks (Mike Willbanks)
Description: ------------ Net_FTP does not run ftp_alloc which is needed by some ftp servers to properly upload. I have provided patch files for this fix. Test script: --------------- Index: FTP.php =================================================================== RCS file: /repository/pear/Net_FTP/Net/FTP.php,v retrieving revision 1.47 diff -u -r1.47 FTP.php --- FTP.php 9 Feb 2006 23:12:33 -0000 1.47 +++ FTP.php 1 Mar 2007 19:05:00 -0000 @@ -1274,6 +1274,7 @@ return $this->raiseError("Remote file '$remote_file' exists and may not be overwriten.", NET_FTP_ERR_OVERWRITEREMOTEFILE_FORBIDDEN); } + ftp_alloc($this->_handle, filesize($file)); if (function_exists('ftp_nb_put')){ $res = @ftp_nb_put($this->_handle, $remote_file, $local_file, $mode); while ($res == FTP_MOREDATA) { Index: FTP_PHP5.php =================================================================== RCS file: /repository/pear/Net_FTP/Net/FTP_PHP5.php,v retrieving revision 1.2 diff -u -r1.2 FTP_PHP5.php --- FTP_PHP5.php 15 Jan 2004 22:57:31 -0000 1.2 +++ FTP_PHP5.php 1 Mar 2007 19:05:23 -0000 @@ -710,7 +710,8 @@ if ((@ftp_size($this->_handle, $remote_file) != -1) && !$overwrite) { return PEAR::raiseError("Remote file '$remote_file' exists and may not be overwriten.", 0); } - + + ftp_alloc($this->_handle, filesize($file)); if (function_exists('ftp_nb_put')){ $res = @ftp_nb_put($this->_handle, $remote_file, $local_file, $mode); while ($res == FTP_MOREDATA) {

Comments

 [2007-03-01 14:29 UTC] mwillbanks
Just to comment on what the manual states that this function may not want to be used in a situation where this function might not work... Since there is no checking of the result in order to continue this will still allow the Net_FTP extension to work properly if this command isn't supported. This is due to how the handling of this function works without flagging a E_WARNING or E_NOTICE. It simply returns a boolean value that can be ignored.
 [2007-11-24 14:50 UTC] jorrit (Jorrit Schippers)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.