#48111 [NEW]: unlink won't delete symlinks without a target
From: simon at stienen dot name
Operating system: FreeBSD 7.1-RELEASE/amd64
PHP version: 5.2.9
PHP Bug Type: Filesystem function related
Bug description: unlink won't delete symlinks without a target
Description:
------------
unlink()ing a symlink with its target missing fails with an open_basedir
error.
This might be related to
http://bugs.php.net/bug.php?id=20235 (actual
deletion changed, but
sanitization still uses target?) and/or
http://bugs.php.net/bug.php?id=29145 (missing
target (empty string?) is
considered to be outside of open_basedir?)
Reproduce code:
---------------
<?php
echo "creating link\n";
symlink('nonexisting_target', 'link');
echo "unlinking link\n";
unlink('link');
echo "creating target\n";
file_put_contents('nonexisting_target', 'foo');
echo "unlinking link (again)\n";
unlink('link');
echo "unlinking target\n";
unlink('nonexisting_target');
Expected result:
----------------
Run with php -d open_basedir=
creating link
unlinking link
creating target
unlinking link (again)
Warning: unlink(link): No such file or directory in /tmp/- on line 13
unlinking target
Actual result:
--------------
Run with php -d open_basedir=/
creating link
unlinking link
Warning: unlink(): open_basedir restriction in effect. File(link) is not
within the allowed path(s): (/) in /tmp/- on line 7
creating target
unlinking link (again)
unlinking target
--
Edit bug report at http://bugs.php.net/?id=48111&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48111&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48111&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48111&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=48111&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48111&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=48111&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=48111&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=48111&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=48111&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=48111&r=support
Expected behavior: http://bugs.php.net/fix.php?id=48111&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=48111&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=48111&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=48111&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48111&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48111&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=48111&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=48111&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=48111&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=48111&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=48111&r=mysqlcfg
Thread (5 messages)
- simon at stienen dot name