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

Bug #813 ftp_nb_put function abort when mode is null
Submitted: 2004-02-20 12:58 UTC Modified: 2004-02-24 14:03 UTC
From: farell Assigned: toby
Status: Closed Package: Net_FTP
PHP Version: 4.3.4 OS: Windows XP
Roadmaps: (Not assigned)    
Subscription  


 [2004-02-20 12:58 UTC] farell
Description: ------------ When you try to move a file on a remote-ftp server with PHP 4.3+ and Net_FTP::put() method, without setting the transfer mode, the file is not fully moved (only the header). Because the mode is NULL by default and should be either FTP_ASCII or FTP_BINARY. None error are returns ! Reproduce code: --------------- <?php require_once 'Net/FTP.php'; $user = 'farell'; $pass = xxxxxx; $host = 'ftpperso.free.fr'; $dest = 'tmp'; $overwrite = true; $file = 'php4ever.png'; // 191 kb $ftp = new Net_FTP(); $ftp->connect($host); $ftp->login($user, $pass); $ftp->cd($dest); $ret = $ftp->put($file, basename($file), $overwrite); if (PEAR::isError($ret)) { $ftp->disconnect(); die($ret->getMessage()); } $ftp->disconnect(); echo 'Done!'; ?> Expected result: ---------------- the file 'php4ever.png' should be fully uploaded (191 kb) on my ftp server. If i set the mode before put() method with $ftp->setMode(FTP_BINARY); All works fine ! So to fix this little problem we have just to set by default the most common transfer mode on class property like that: var $_mode = FTP_BINARY; That's all ! Actual result: -------------- Only a part of file (the header : 5kb) was moved at right place.

Comments

 [2004-02-24 14:03 UTC] toby
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.