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] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!