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

Bug #5337 _list_and_parse behavior with an empty remote directory
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 Add Comment Add patch

Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem : 21 + 15 = ?

 [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" }


 [2006-02-09 23:05 UTC] toby
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. I see this as a bug. I added an exception to _list_and_parse() to catch this behavior of your FTP server.