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

Bug #2268 getRecursive does not work because of '.' and '..' directories
Submitted: 2004-09-01 18:54 UTC
From: joern_h at gmx dot net Assigned: toby
Status: Closed Package: Net_FTP
PHP Version: 4.3.0 OS: Windows 2000
Roadmaps: (Not assigned)    
Subscription  
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:
MUST BE VALID
Solve the problem : 35 - 9 = ?

 
 [2004-09-01 18:54 UTC] joern_h at gmx dot net
Description: ------------ getRecursive tries to recurse into '.' directory and therefore hangs. A quick patch is attached. Reproduce code: --------------- C:\Programme\php\pear\Net>diff FTP.php ftp.php.jh 1305,1309c1305,1311 < $remote_path_new = $remote_path.$dir_entry["name"]."/"; < $local_path_new = $local_path.$dir_entry["name"]."/"; < $result = $this->getRecursive($remote_path_new, $local_path_new, $overwrite, $mode); < if ($this->isError($result)) { < return $result; --- > if ($dir_entry['name'] != '.' && $dir_entry['name'] != '..') { > $remote_path_new = $remote_path.$dir_entry["name"]."/"; > $local_path_new = $local_path.$dir_entry["name"]."/"; > $result = $this->getRecursive($remote_path_new, $local_path_new, $overwrite, $mode); > if ($this->isError($result)) { > return $result; > }

Comments

 [2004-09-06 18:12 UTC] toby
The patch is against which version?
 [2004-09-07 18:16 UTC] joern_h at gmx dot net
FTP.php says it is Net_FTP Version 1.3 $Id: FTP.php,v 1.26 2004/06/14 22:26:48 toby Exp $ I upgraded to PHP 4.3.8 today and see the same behavior so its probably not a bug in the ftp extension. Adding a print_r($dir_list) in getRecursive() before foreach ($dir_list as $dir_entry) shows the following output: Array ( [0] => Array ( [name] => . [size] => 4096 [rights] => rwx--x--- [user] => 22210 [group] => nobody [files_inside] => 3 [date] => Sep 6 22:17 [is_dir] => d [stamp] => 1094501820 ) [1] => Array ( [name] => .. [size] => 4096 [rights] => rwx--x--- [user] => 22210 [group] => nobody [files_inside] => 6 [date] => Apr 18 19:51 [is_dir] => d [stamp] => 1082310660 ) [2] => Array ( [name] => news [size] => 4096 [rights] => rwx--x--- [user] => 22210 [group] => nobody [files_inside] => 3 [date] => Aug 23 16:43 [is_dir] => d [stamp] => 1093272180 ) ) The code then tries to recurses into the '.' repeats this forever. If you need more information don't hesitate to ask.
 [2004-09-22 17:38 UTC] toby
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.