ID: 33140
Comment by: zefredz at gmail dot com
Reported By: cbelin at free dot fr
Status: No Feedback
Bug Type: Directory function related
Operating System: Win32
PHP Version: 5CVS-2005-05-26
New Comment:
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>
Previous Comments:
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
[2006-03-15 08:48:03] zefredz at gmail dot com
I have the same bug with PHP 5.0.4 and the given snapshot. But other
PHP developpers in my development team does not get the error message
while using the same PHP version than mine. The problem occurs on my
computer with PHP 5.1 too.
The only difference I can figure out between those developers and I is
that I am still using Windows XP SP1 while they are using Windows XP
SP2. Can this be the cause of the bug ?
------------------------------------------------------------------------
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