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

Bug #7146 Recursive mkdir fails on Windows
Submitted: 2006-03-17 15:46 UTC Modified: 2007-11-24 14:49 UTC
From: philip at e-frag dot co dot uk Assigned: jorrit
Status: Closed Package: Net_FTP (version 1.3.2)
PHP Version: 5.1.1 OS: Windows
Roadmaps: 1.3.3    
Subscription  


 [2006-03-17 15:46 UTC] philip at e-frag dot co dot uk (Philip Lorenz)
Description: ------------ The mkdir function of the class fails to recursively create the directory structure when run on windows (due to the different behaviour of dirname()). Test script: --------------- Replace: $res = $this->mkdir(dirname($dir), true); with: $res = $this->mkdir(str_replace("\\", "/", dirname($dir)), true);

Comments

 [2006-03-17 16:07 UTC] philip at e-frag dot co dot uk
Infact the fix listed above may break other directories. Hence checking whether the dirname equals "\" probably will be the best fix for this issue.
 [2007-11-18 05:30 UTC] jorrit (Jorrit Schippers)
I have added a patch. Does it work now? The essential part is: // do not look at the first character, as $dir is absolute, // it will always be a / if (strpos(substr($dir, 1), '/') === false) { return $this->mkdir($dir, false); } $parent = substr($dir, 0, strrpos($dir, '/')); $res = $this->mkdir($parent, true); if ($res === true) { $res = $this->mkdir($dir, false); } if ($res !== true) { return $res; } return true;
 [2007-11-24 14:49 UTC] jorrit (Jorrit Schippers)
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.