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

Bug #4969 Recursive rm ends in endless loop
Submitted: 2005-08-02 12:03 UTC
From: people05 at sopic dot com Assigned: toby
Status: Closed Package: Net_FTP
PHP Version: 5.0.4 OS: Debian GNU/Linux 3.1
Roadmaps: (Not assigned)    
Subscription  


 [2005-08-02 12:03 UTC] people05 at sopic dot com
Description: ------------ Recursive rm ends in endless loop, 'cos FTP.php tries to delete "." and "..". So when you like to delete /httpdocs/ demo/, the script tries do delete /httpdocs/demo/./ /httpdocs/demo/././ /httpdocs/demo/./././ /httpdocs/demo/././././ /httpdocs/demo/./././././ /httpdocs/demo/././././././ and so on. A possible patch can be found on http://www.sopic.com/test/ FTP.diff. Test script: --------------- <?php require_once('Net/FTP.php'); $ftp = new NET_FTP('localhost', 21); $ftp->connect(); $ftp->login('demo', 'password'); var_dump($ftp->mkdir('/httpdocs/demo/test/My test directory/', true)); var_dump($ftp->ls('/httpdocs')); var_dump($ftp->rm('/httpdocs/demo/', true)); var_dump($ftp->ls('/httpdocs')); $ftp->disconnect(); ?> Expected result: ---------------- true array 0 => array 'name' => '.' 'size' => '4096' 'rights' => 'rwxr-x---' 'user' => 'demo' 'group' => 'psaserv' 'files_inside' => '4' 'date' => 'Aug 2 13:59' 'is_dir' => 'd' 'stamp' => 1122983940 1 => array 'name' => '..' 'size' => '4096' 'rights' => 'rwxr-xr-x' 'user' => 'root' 'group' => 'root' 'files_inside' => '5' 'date' => 'Jul 2 20:53' 'is_dir' => 'd' 'stamp' => 1120330380 2 => array 'name' => 'demo' 'size' => '4096' 'rights' => 'rwxr-xr-x' 'user' => 'demo' 'group' => 'psacln' 'files_inside' => '3' 'date' => 'Aug 2 13:59' 'is_dir' => 'd' 'stamp' => 1122983940 3 => array 'name' => 'index.php' 'size' => '579' 'rights' => 'rw-r--r--' 'user' => 'demo' 'group' => 'psacln' 'files_inside' => '1' 'date' => 'Jul 19 16:13' 'is_dir' => '' 'stamp' => 1121782380 true array 0 => array 'name' => '.' 'size' => '4096' 'rights' => 'rwxr-x---' 'user' => 'demo' 'group' => 'psaserv' 'files_inside' => '3' 'date' => 'Aug 2 13:59' 'is_dir' => 'd' 'stamp' => 1122983940 1 => array 'name' => '..' 'size' => '4096' 'rights' => 'rwxr-xr-x' 'user' => 'root' 'group' => 'root' 'files_inside' => '5' 'date' => 'Jul 2 20:53' 'is_dir' => 'd' 'stamp' => 1120330380 2 => array 'name' => 'index.php' 'size' => '579' 'rights' => 'rw-r--r--' 'user' => 'demo' 'group' => 'psacln' 'files_inside' => '1' 'date' => 'Jul 19 16:13' 'is_dir' => '' 'stamp' => 1121782380 Actual result: -------------- true

Comments

 [2006-02-09 22:51 UTC] toby
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net 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.