#29145 [Opn->WFx]: unlink() won't delete symlink pointing outside open_basedir
| From: | iliaa@php.net | Date: | Wed, 14 Jul 2004 22:36:04 +0000 |
| Subject: | #29145 [Opn->WFx]: unlink() won't delete symlink pointing outside open_basedir | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-62309@lists.php.net to get a copy of this message | ||
ID: 29145
Updated by: iliaa@php.net
Reported By: francois at bonzon dot com
-Status: Open
+Status: Wont fix
Bug Type: Filesystem function related
Operating System: linux
PHP Version: 4.3.7
New Comment:
The nature of open_basedir handling prevents this behavior.
This is almost impossible to change without a lot of
special exceptions for unlink() operations on symlinks.
Previous Comments:
------------------------------------------------------------------------
[2004-07-14 15:12:17] francois at bonzon dot com
Description:
------------
First, remember that when you delete a symlink (symbolic link) with the
unlink() function, the link file itself is deleted, not the target file
it references.
When you try to delete a symbolic link and an open_basedir restriction
is in effect, with the link file itself inside the allowed path(s), but
the target file outside the allowed path(s), then PHP incorrectly
refuses to do it.
Reproduce code:
---------------
# the file 'test' is a symlink to '/home'
unlink($_SERVER['DOCUMENT_ROOT'] . '/debug/test');
Expected result:
----------------
PHP shouldn't resolve the symbolic link when determining whether or not
it is within the allowed path(s), and allow the deletion. It should't
care what the link references, but only whether the link file itself is
in the allowed path(s).
Actual result:
--------------
PHP throws this error message:
Warning: unlink(): open_basedir restriction in effect.
File(/home/sites/site23/web/debug/test) is not within the allowed
path(s): (/home/sites/site23:/tmp) in
/home/sites/site23/web/debug/unlink.php on line 6
You can see the contradiction in this message:
/home/sites/site23/web/debug/test is indeed in the /home/sites/site23
directory-tree.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29145&edit=1