Bug #61521 [NEW]: fopen uses stale data on symlinks - opens old file instead
From:
Operating system: Ubuntu
PHP version: 5.3.10
Package: Filesystem function related
Bug Type: Bug
Bug description:fopen uses stale data on symlinks - opens old file instead
Description:
------------
After opening a symlink, PHP will always use the original link location,
even if the link is externally modified during script execution.
Test script:
---------------
<?php
file_put_contents("linkOrig", "old data");
file_put_contents("linkNew", "new data");
//create the link
symlink("linkOrig", "link");
//ln -s linkOrig link;//this also works
file_get_contents("link");//open it and read it (caches the link data)
//simulate another program altering it
ln -fs linkNew link;
echo file_get_contents("link");
Expected result:
----------------
new data
Actual result:
--------------
old data
--
Edit bug report at https://bugs.php.net/bug.php?id=61521&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=61521&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=61521&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=61521&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=61521&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61521&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=61521&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=61521&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=61521&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=61521&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=61521&r=support
Expected behavior: https://bugs.php.net/fix.php?id=61521&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=61521&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=61521&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=61521&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=61521&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=61521&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=61521&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=61521&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=61521&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=61521&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=61521&r=mysqlcfg
Thread (2 messages)
- jstephens at qualtrics dot com