From: francois at bonzon dot com Operating system: linux PHP version: 4.3.7 PHP Bug Type: Filesystem function related Bug description: unlink() won't delete symlink pointing outside open_basedir
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 bug report at http://bugs.php.net/?id=29145&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29145&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29145&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=29145&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29145&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29145&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29145&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29145&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=29145&r=support Expected behavior: http://bugs.php.net/fix.php?id=29145&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=29145&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=29145&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29145&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29145&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29145&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29145&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=29145&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29145&r=float