Bug #66497 [NEW]: symlink improperly creates recursive link on existing symlink without a target
| From: | mattsch at gmail dot com | Date: | Thu, 16 Jan 2014 15:18:48 +0000 |
| Subject: | Bug #66497 [NEW]: symlink improperly creates recursive link on existing symlink without a target | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-183839@lists.php.net to get a copy of this message | ||
From: mattsch at gmail dot com
Operating system: Gentoo Linux
PHP version: 5.5.8
Package: Filesystem function related
Bug Type: Bug
Bug description:symlink improperly creates recursive link on existing symlink without a target
Description:
------------
symlink improperly creates a recursive link on existing symlink without
a target. This appears to be a regression since php 5.2 which was
broken in php 5.3 and all subsequent versions. In php 5.2, calling
symlink on an existing symlink always failed regardless whether the
target existed.
Test script:
---------------
<?php
/*
Make symlink create a symbolic link that does not link to anything (link
does not exist)
*/
symlink('43', '0'); // Result: 0 -> 43
// second call to the same thing
symlink('43', '0'); // Result: 43 -> 43
/*
third call will fail with a warning:
PHP Warning: symlink(): No such file or directory in test.php on line
2
*/
symlink('43', '0');
Expected result:
----------------
symlink should fail and emit a warning after the second call to a
non-existing link and not create a recursive link on the target.
Actual result:
--------------
symlink fails on the third call to create a symlink that already exists
after creating a recursive symlink to the target.
--
Edit bug report at https://bugs.php.net/bug.php?id=66497&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66497&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66497&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66497&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66497&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66497&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66497&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66497&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66497&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66497&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66497&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66497&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66497&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66497&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66497&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66497&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66497&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66497&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66497&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66497&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66497&r=mysqlcfg