Home » Networking » Net_FTP » Bug #4749
ls() fails when connection is closed
Details
| Submitted | 2005-07-05 12:48 UTC |
|---|---|
| From | javascripter at mail dot ru |
| Assigned | toby |
| Status | Closed |
| Package | Net_FTP |
| PHP Version | 5.0.4 |
| OS | Windows XP SP2 |
| Roadmaps | (Not assigned) |
Comments
[2005-07-05 12:48 UTC] javascripter at mail dot ru
Description:
------------
A call to Net_FTP::ls() fails with Fatal Error when connection is closed by the server.
If I'm right, the problem lies in _ls_both($dir) function which misses PEAR::isError($list_splitted) check.
Reproduce code:
---------------
The following piece of code
function _ls_both($dir)
{
$list_splitted = $this->_list_and_parse($dir);
if (!is_array($list_splitted["files"])) {
$list_splitted["files"] = array();
}
[...skipped...]
}
should look like
function _ls_both($dir)
{
$list_splitted = $this->_list_and_parse($dir);
if (PEAR::isError($list_splitted)) {
return $list_splitted;
}
if (!is_array($list_splitted["files"])) {
$list_splitted["files"] = array();
}
[...skipped...]
}
Actual result:
--------------
Fatal Error: Cannot use object of type PEAR_Error as array in C:\Server\php5\PEAR\Net\FTP.php on line 1924