ID: 45228
User updated by: nanawel at eyeos dot org
-Summary: unlink() doesn't work with path like
"file:///C:/my/path..."
Reported By: nanawel at eyeos dot org
Status: Open
Bug Type: Filesystem function related
Operating System: Windows XP Pro SP2 (32bits)
PHP Version: 5.2.6
New Comment:
A new set of problems:
- mkdir() only works with file://C:/my/path
and fails on file:///C:/my/path
or file://localhost/C:/my/path
- rmdir() DOES NOT WORK with file://C:/my/path
or file:///C:/my/path
or file://localhost/C:/my/path
Previous Comments:
------------------------------------------------------------------------
[2008-06-10 16:03:21] nanawel at eyeos dot org
Additionnally, unlink() doesn't work either on URL like:
file://localhost/C:/my/path
and this is particularly _not_ normal.
------------------------------------------------------------------------
[2008-06-10 15:56:21] nanawel at eyeos dot org
Description:
------------
The unlink() function does not work with full Windows URL, whereas
fopen() for example works perfectly.
If you provide a path like this: file:///C:/my/path
(triple slashes) it won't work and you will get this warning:
Warning: unlink(/C:/my/path) [function.unlink]: Invalid argument in...
But if you provide this path: file://C:/my/path
(so just a slash less) unlink will work.
Reproduce code:
---------------
//For the example, we consider that PHP has full permissions on
config.sys, which is not the case normally)
$path1 = 'file:///C:/config.sys';
$path2 = 'file://C:/config.sys';
$fp = fopen($path1, 'r'); //OK
@fclose($fp);
unlink($path1); //ERROR
$fp = fopen($path2, 'r'); //OK
@fclose($fp);
unlink($path2); //OK
Expected result:
----------------
unlink() should work with the same standards URL as fopen().
In my example, $path1 should be correct for both functions.
Actual result:
--------------
Windows absolute URL like file:///C:/... work with fopen(), rename()
but _not_ with unlink() (+ Warning raised)
Windows non-standard URL like file://C:/... work with fopen(), rename()
and unlink()
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45228&edit=1