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

Bug #12639 Net_FTP rm() method problem
Submitted: 2007-12-08 08:03 UTC
From: bnred4 Assigned: jorrit
Status: Closed Package: Net_FTP (version 1.3.3)
PHP Version: 5.2.5 OS: Windows XP SP2
Roadmaps: 1.3.4    
Subscription  


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:
MUST BE VALID
Solve the problem : 31 - 8 = ?

 
 [2007-12-08 08:03 UTC] bnred4 (Brandon Nichols)
Description: ------------ var_dump($test->rm('bn/', true)); Test script: --------------- <?PHP function ftpDeleteAll($ftp_server, $folderPath, $ftp_user_name, $ftp_user_pass){ require_once 'Net/FTP.php'; $test = new Net_FTP($ftp_server, 21); $test->connect($ftp_server, 21); $test->login($ftp_user_name, $ftp_user_pass); $test->rm("bn/images/", true); $test->disconnect(); } Expected result: ---------------- The bn/images/ folder should be removed along with any thing inside. Actual result: -------------- Nothing is removed, including the images folder. I tested the exact script using Net_FTP version 1.3.2 and it worked perfectly.

Comments

 [2007-12-08 12:37 UTC] bnred4 (Brandon Nichols)
With further research I have found the problem... the patch I uploaded is not the correct way to fix the problem. I will be uploading a different patch very soon. As of now, I gotta get some shuteye! :)
 [2007-12-08 13:52 UTC] bnred4 (Brandon Nichols)
...who needs sleep? I have uploaded a new patch. This one works and has been tested by myself. Enjoy! Brandon Nichols
 [2007-12-08 15:11 UTC] jorrit (Jorrit Schippers)
The problem is that the checkDir method is very unreliable: if someone would supply a directory name without a slash to a function that uses checkDir, it would not recognize it. It should be replaced by a command that tries to chdir into the directory, which would be fool proof. However, for now, the changes to _constructPath have to be reversed, because it causes more problems than it solves. I have put a fix in CVS, could you test it?
 [2007-12-08 19:26 UTC] bnred4 (Brandon Nichols)
Sure I'll test it. I noticed that problem too... checking for a slash is not a very effective way to make sure the path is a directory.
 [2007-12-08 19:48 UTC] bnred4 (Brandon Nichols)
I tried the cvs code out. Works for me, however if you'll take a look at the patch I supplied I think you will find that it is ready for changes to the _checkDir() function. In other words, since we know that the _checkDir() function is lacking we should try to fix it. Using the patch I uploaded will work for the current _checkDir() and the new _checkDir() function. I'll see what I can do as far as fixing the _checkDir() function. :)
 [2007-12-09 17:44 UTC] jorrit (Jorrit Schippers)
Well the conflict between _constructPath() and _checkDir() is present in more methods, so _checkDir() should be reverted anyway.
 [2007-12-10 20:42 UTC] jorrit (Jorrit Schippers)
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/Net_FTP