Edit report at https://bugs.php.net/bug.php?id=36555&edit=1
ID: 36555 Comment by: v dot rutkunas at pccsuk dot com Reported by: p at damezin dot com Summary: realpath_cache never updated with symlinks (removed or renamed) Status: Not a bug Type: Bug Package: Filesystem function related Operating System: Linux OpenBSD PHP Version: 5.2.0 Block user comment: N Private report: N New Comment: XAMPP - Apache 2.4, PHP 5.4.7 here, bug still exists... Previous Comments: ------------------------------------------------------------------------ [2012-09-09 01:20:08] webmaster at wininup dot com Sorry, the last workaround with fopen() is not working better. Same bug. ------------------------------------------------------------------------ [2012-09-09 01:06:58] webmaster at wininup dot com Well this basic workaround is to replace file_get_contents($symlink) with : $fh = fopen($symlink, 'r'); $raw = fread($fh, filesize($symlink)); fclose($symlink); ------------------------------------------------------------------------ [2012-09-08 16:04:14] webmaster at wininup dot com Same problem for this user : http://sixohthree.com/1517/php-and-the-realpath- cache He seems right telling that the cache is not thread safe. ------------------------------------------------------------------------ [2012-09-08 15:51:17] webmaster at wininup dot com Well, i'm afraid I can only reproduce this bug when it's used through Apache. Testing is hard because it does not appear at the first time. Download the file "test.php" from this URL : http://dl.dropbox.com/u/62007491/test.php To init the test, in the same directory that "test.php" please create a directory "writable", writable by Apache ("mkdir writable && chmod 777 writable" for testing should be okay). 1. Run the script with the $flag = true. This should create 2 files in the writable directory, the "content" file, plus the symlink file. 2. Execute the script multiple times (this is important) by pressing F5. No error should occur. 3. Now Run the same script with the $flag = false. This should delete this "content" and "symlink" file. 4. Execute the script multiple times (this is important) 5. Then Run the same process from the step 1 to 4. Try again until you see that the step 1 ($flag = true) fails with : ---------------------------------------- Warning: symlink(): File exists in /var/www/html/test/test.php on line 37 islink: Warning: linkinfo(): No such file or directory in /var/www/html/test/test.php on line 41 linkinfo: -1 Warning: readlink(): No such file or directory in /var/www/html/test/test.php on line 42 readlink: php version : 5.4.6 realpath_cache_size (if available) : 16K Array ( [0] => /var/www/html/test/writable/content_42 ) ---------------------------------------- => As you can see in the above output, the symlink() fails with "File exists" but the symlink actually does not exist !! Hope this helps. ------------------------------------------------------------------------ [2012-09-07 17:16:40] larue...@php.net I can not reproduce this. could you explain your test steps? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=36555 -- Edit this bug report at https://bugs.php.net/bug.php?id=36555&edit=1