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

Bug #336 ftp_login displays Warning
Submitted: 2003-12-02 13:18 UTC
From: schst Assigned: toby
Status: Closed Package: Net_FTP
PHP Version: Irrelevant OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2003-12-02 13:18 UTC] schst
Description: ------------ When supplying incorrect login informattion the login() method displays a Waring: Warning: ftp_login(): Login incorrect. in /mnt/projekte/pear/Net/FTP.php on line 219 An @ should be used in front of the function...

Comments

 [2003-12-02 13:28 UTC] toby
Will fix this asap.
 [2003-12-31 10:07 UTC] chip at php dot net
Patch should fix this and other possible warnings: --- FTP.php.dist 2003-12-31 10:07:22.000000000 +0000 +++ FTP.php 2003-12-31 10:04:33.000000000 +0000 @@ -334,7 +334,7 @@ if ($this->_check_dir($file)) { return $this->raiseError("Filename '$file' seems to be a directory.", 0); } - $res = ftp_mdtm($this->_handle, $file); + $res = @ftp_mdtm($this->_handle, $file); if ($res == -1) { return $this->raiseError("Could not get last-modification-date of '$file'.", 0); } @@ -360,7 +360,7 @@ function size ( $file ) { $file = $this->_construct_path($file); - $res = ftp_size($this->_handle, $file); + $res = @ftp_size($this->_handle, $file); if ($res == -1) { return $this->raiseError("Could not determine filesize of '$file'.", 0); } else { @@ -416,7 +416,7 @@ function ls ( $dir = null, $mode = NET_FTP_DIRS_FILES ) { if (!isset($dir)) { - $dir = ftp_pwd($this->_handle); + $dir = @ftp_pwd($this->_handle); if (!$dir) { return $this->raiseError("Could not retrieve current directory", 4); } @@ -432,10 +432,9 @@ break; case NET_FTP_FILES_ONLY: $res = $this->_ls_files ( $dir ); break; - case NET_FTP_RAWLIST: $res = ftp_rawlist($this->_handle, $dir); + case NET_FTP_RAWLIST: $res = @ftp_rawlist($this->_handle, $dir); break; } - return $res; } @@ -736,7 +735,7 @@ function _construct_path ( $path ) { if (substr($path, 0, 1) != "/") { - $actual_dir = ftp_pwd($this->_handle); + $actual_dir = @ftp_pwd($this->_handle); if (substr($actual_dir, (strlen($actual_dir) - 2), 1) != "/") { $actual_dir .= "/"; } @@ -777,7 +776,7 @@ if (substr($file, 0, 1) == "/") { $res = @ftp_delete($this->_handle, $file); } else { - $actual_dir = ftp_pwd($this->_handle); + $actual_dir = @ftp_pwd($this->_handle); if (substr($actual_dir, (strlen($actual_dir) - 2), 1) != "/") { $actual_dir .= "/"; } @@ -922,13 +921,13 @@ function _list_and_parse ( $dir ) { $dirs_list = array(); $files_list = array(); - $dir_list = ftp_rawlist($this->_handle, $dir); + $dir_list = @ftp_rawlist($this->_handle, $dir); foreach ($dir_list as $entry) { // ([1] = directory?, [2] = rights, [3] = files below, [4] = user, // [5] = group, [6] = size, [7] = date, [8] = name) $res_1 = @ereg(NET_FTP_DIR_EREG ,$entry,$eregs); if (!$res_1) { - var_dump($entry); + // var_dump($entry); return $this->raiseError("Raw directory-list in wrong format.", 0); } $is_dir = (@trim($eregs[1]) == "d"); @@ -1108,12 +1107,12 @@ * Set the transfer-method to passive mode * * @access public - * @return void + * @return bool */ function setPassive () { $this->_passv = true; - ftp_pasv($this->_handle, true); + return @ftp_pasv($this->_handle, true); } /** @@ -1121,12 +1120,12 @@ * Set the transfer-method to active mode * * @access public - * @return void + * @return bool */ function setActive () { $this->_passv = false; - ftp_pasv($this->_handle, false); + return @ftp_pasv($this->_handle, false); } /**
 [2004-01-05 23:11 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.