ID: 29145 Updated by: [EMAIL PROTECTED] 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