ID: 33140
Comment by: zefredz at gmail dot com
Reported By: cbelin at free dot fr
Status: Open
Bug Type: Directory function related
Operating System: Win32
PHP Version: 5CVS-2005-05-26
New Comment:
This issue is fixed under Windows with PHP 5.2.0
Previous Comments:
------------------------------------------------------------------------
[2006-07-09 11:14:14] zefredz at gmail dot com
It still does not work with '/' and recursive mode under windows :
<code>
<?php
mkdir ('toto/tutu/titi', 0777, true );
?>
</code>
Warning: mkdir(): No such file or directory in
C:\var\downloads\php5.2-win32-latest\test_mkdir.php on line 2
and
<code>
<?php
mkdir ('C:/var/downloads/php5.2-win32-latest/toto/tutu/titi', 0777,
true );
?>
</code>
Using '\' works :
<code>
<?php
mkdir ('toto\tutu\titi', 0777, true );
?>
</code>
and
<code>
<?php
mkdir ('C:\var\downloads\php5.2-win32-latest\toto\tutu\titi', 0777,
true );
?>
</code>
work fine.
There is no problem in non-recursive mode and the following works fine
:
<code>
$path = 'tata/toto/tutu/titi';
$parts = explode( '/', $path );
$trail = '';
foreach( $parts as $part )
{
$trail .= $part . '/';
if ( file_exists( $trail ) )
{
return false;
}
else
{
if ( is_dir( dirname( $trail ) ) )
{
mkdir ( $trail, 0777 );
}
}
}
</code>
------------------------------------------------------------------------
[2006-06-28 01:00:00] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2006-06-20 16:16:11] [EMAIL PROTECTED]
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
------------------------------------------------------------------------
[2006-03-29 20:07:32] ksteinhoff at gmail dot com
I see this bug on Mac OS X 10.4.5 with PHP 5.1.2.
I've also noticed what I assume is a related problem with creating
directories in the current directory. For example, if I run the script
below in /tmp, the second (and fifth) mkdir will fail.
<?php
// e.g. running in /tmp
mkdir('new1', 0700, true); // works
mkdir('new2/sub', 0700, true); // fails
mkdir('/tmp/new3/sub', 0700, true); // works
mkdir('../tmp/new4/sub', 0700, true); // works
mkdir('/new5/sub', 0700, true); // fails, confirming
// the original bug.
?>
------------------------------------------------------------------------
[2006-03-15 09:02:51] zefredz at gmail dot com
I have made a little test and I figure out taht giving the full path is
not required but that you have to use the backslashes instead of the
slashes to make the recursive mkdir work :
<code>
mkdir ('toto/tutu/titi', 0777, true); # FAILS
mkdir ('toto\tutu\titi', 0777, true); # WORKS
</code>
But when not in recursive mode, mkdir works with either slashes or
backslashes.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/33140
--
Edit this bug report at http://bugs.php.net/?id=33140&edit=1