PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Networking » Net_FTP » Bug #4749

ls() fails when connection is closed

Details

Submitted2005-07-05 12:48 UTC
Fromjavascripter at mail dot ru
Assignedtoby
StatusClosed
PackageNet_FTP
PHP Version5.0.4
OSWindows 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