Home » Networking » Net_FTP » Bug #5337
_list_and_parse behavior with an empty remote directory
Details
| Submitted | 2005-09-08 13:56 UTC |
|---|---|
| From | nkahn at cmd dot lu |
| Assigned | toby |
| Status | Closed |
| Package | Net_FTP |
| PHP Version | 4.3.10 |
| OS | Debian Sarge |
| Roadmaps | (Not assigned) |
Comments
[2005-09-08 13:56 UTC] nkahn at cmd dot lu
Description:
------------
Hello,
I have a question regarding the way to modify "_list_and_parse" function to handle my FTP server behavior with empty directory. Indeed in that case the FTP server returns the string "total 0" to indicate that there is no file in it. The problem is that the result of "ftp_rawlist" function is no more an empty array but an array with one element as described below. So "_list_and_parse" function tries to find a match with an OS specification and can't since there is no match defined in attribute "_ls_match".
Should I implement such a matching pattern in attribute "_ls_match" or is there another way to handle it ?
Thanks for your help.
Nicolas Kahn
Test script:
---------------
// set up basic connection
$conn_id = ftp_connect(FTP_HOST);
// login with username and password
$login_result = ftp_login($conn_id, FTP_USERNAME, FTP_PASSWORD);
// get the file list
$buff = ftp_rawlist($conn_id, FTP_REMOTE_PATH);
// output the buffer
echo "ftp_rawlist: ", var_dump($buff), "\n";
// close the connection
ftp_close($conn_id);
Expected result:
----------------
ftp_rawlist: array(0) {
}
Actual result:
--------------
ftp_rawlist: array(1) {
[0]=>
string(7) "total 0"
}