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

Bug #7146 Recursive mkdir fails on Windows
Submitted: 2006-03-17 20:46 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    

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:
Solve the problem : 48 - 16 = ?

 [2006-03-17 20: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);


 [2006-03-17 21: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 10: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 19:49 UTC] jorrit (Jorrit Schippers)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the 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.