Home » Networking » Net_FTP » Bug #440
Notice appears
Details
| Submitted | 2003-12-16 17:24 UTC |
|---|---|
| From | alexandre at tela-botanica dot org |
| Assigned | toby |
| Status | Closed |
| Package | Net_FTP |
| PHP Version | 4.3.3 |
| OS | Mandrake linux 9.2 |
| Roadmaps | (Not assigned) |
Comments
[2003-12-16 17:24 UTC] alexandre at tela-botanica dot org
Description:
------------
Many notice from the php engine occurs while deleting a directory.
these are the messages :
Notice: Undefined variable: list in /usr/share/pear/Net/FTP.php on line 887
Notice: Undefined variable: list in /usr/share/pear/Net/FTP.php on line 887
Notice: Undefined variable: list in /usr/share/pear/Net/FTP.php on line 887
Notice: Undefined variable: true in /usr/share/pear/Net/FTP.php on line 812
Notice: Undefined variable: true in /usr/share/pear/Net/FTP.php on line 812
etc.
Reproduce code:
---------------
$ftp = new Net_FTP ($Host, $Port) ;
$ftp->connect() ;
$resultat =$ftp->login($User, $Pwd) ;
if (PEAR::isError($resultat)) $msg .= "Impossible de s'identifier au serveur FTP" ;
$resultat = $ftp->rm (GEN_CHEMIN_FTP."sites/$managedProject/", true) ; // here is the problem
Expected result:
----------------
The code works perfectly, but i'd prefer without the notice messages
Actual result:
--------------
Notice: Undefined variable: list in /usr/share/pear/Net/FTP.php on line 887
Notice: Undefined variable: true in /usr/share/pear/Net/FTP.php on line 812
[2003-12-31 10:04 UTC] chip at php dot net
I think this patch should fix these notices:
--- FTP.php.dist 2003-12-31 09:49:15.000000000 +0000
+++ FTP.php 2003-12-31 10:04:33.000000000 +0000
@@ -809,7 +808,7 @@
if (!$res) {
return $this->raiseError("Could not delete directory '$dir'.", 0);
} else {
- return true;
+ return $true;
}
}
@@ -884,10 +883,10 @@
*/
function _ls_dirs ( $dir ) {
- if (!is_array($list["files"])) {
+ $list = $this->_list_and_parse($dir);
+ if (!is_array($list["dirs"])) {
$list["dirs"] = array();
}
- $list = $this->_list_and_parse($dir);
return $list["dirs"];
}