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    
Subscription  
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes. If this is not your bug, you can add a comment by following this link. If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
2007-11-24 19:49 UTC
Package:
Bug Type:
Summary:
From: philip at e-frag dot co dot uk
New email:
PHP Version: Package Version: OS:

 

 [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);

Comments

 [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 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.