ID: 33140 Updated by: [EMAIL PROTECTED] Reported By: cbelin at free dot fr -Status: Verified +Status: Feedback Bug Type: Directory function related Operating System: * PHP Version: 5CVS-2005-05-26 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip Previous Comments: ------------------------------------------------------------------------ [2005-06-23 22:18:44] [EMAIL PROTECTED] When the top directory doesn't exist, the code tries to create directory with empty name because on the previous step we changed first "/" to '\0'. IMO the simplest way is to check if the first character is 0 and change it to DEFAULT_SLASH. Not sure how it would work on Windows though. Index: main/streams/plain_wrapper.c =================================================================== RCS file: /repository/php-src/main/streams/plain_wrapper.c,v retrieving revision 1.47 diff -u -p -d -r1.47 plain_wrapper.c --- main/streams/plain_wrapper.c 20 Jun 2005 15:59:12 -0000 1.47 +++ main/streams/plain_wrapper.c 23 Jun 2005 20:06:47 -0000 @@ -1091,6 +1091,9 @@ static int php_plain_files_mkdir(php_str break; } } + if (*buf == 0) { + *buf = DEFAULT_SLASH; + } if (p == buf) { ret = php_mkdir(dir, mode TSRMLS_CC); } else if (!(ret = php_mkdir(buf, mode TSRMLS_CC))) { ------------------------------------------------------------------------ [2005-05-25 19:54:31] cbelin at free dot fr Note : this bug doesn't appear when you specify a drive letter. <?php mkdir('C:\toto\tata\titi', 0777, true); ?> ------------------------------------------------------------------------ [2005-05-25 18:02:41] cbelin at free dot fr Description: ------------ Recursive 'mkdir' (with PHP 5.0.4 and Windows) doesn't function correctly when the path includes a non-existent root folder. Reproduce code: --------------- <?php mkdir('\toto\tata\titi', 0777, true); ?> Expected result: ---------------- The following structure of directories should have been created : \toto\tata\titi Actual result: -------------- No directory being created ! The function 'mkdir' fails if directory '\toto' doesn't already exists. Instead, it outputs : Warning: mkdir() [function.mkdir]: No such file or directory in xxx.php on line xxx So I must use this code : <?php mkdir('\toto'); mkdir('\toto\tata\titi', 0777, true); ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33140&edit=1
