#45228 [Opn->Fbk]: unlink() & rmdir() do not work well with URL (file://)
| From: | pajoye@php.net | Date: | Wed, 07 Jan 2009 14:18:50 +0000 |
| Subject: | #45228 [Opn->Fbk]: unlink() & rmdir() do not work well with URL (file://) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-132627@lists.php.net to get a copy of this message | ||
ID: 45228
Updated by: pajoye@php.net
Reported By: nanawel at eyeos dot org
-Status: Open
+Status: Feedback
Bug Type: Filesystem function related
Operating System: Windows
PHP Version: 5.2.6
New Comment:
Confusing comments.
Does unlink work on linux?
Does unlink work on Windows?
Does rmdir work on Windows?
Does rmdir work on Windows?
Previous Comments:
------------------------------------------------------------------------
[2009-01-07 13:58:34] nanawel at eyeos dot org
Just changed the OS concerned by the issue.
------------------------------------------------------------------------
[2008-07-14 20:08:57] nanawel at eyeos dot org
Another great one:
rmdir() DOES NOT WORK with the file:// scheme, AT ALL.
Tested on Windows and Ubuntu 8.04 (both on PHP 5.2.6).
------------------------------------------------------------------------
[2008-06-10 16:46:19] nanawel at eyeos dot org
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
------------------------------------------------------------------------
[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