ID: 36555 User updated by: p at damezin dot com -Summary: realpath_cache bug: readfile get old data after a symlink over an existing link Reported By: p at damezin dot com Status: Bogus Bug Type: Filesystem function related Operating System: Linux OpenBSD PHP Version: 5.2.0 New Comment:
New simplified testcase : <?php define('TEST_FILE1', '/tmp/testfile1'); define('TEST_LINK', '/tmp/testlink'); file_put_contents(TEST_FILE1, '42'); // create TEST_LINK pointing on TEST_FILE1 using a temporary filename (needed) $tmp_link_name = TEST_LINK . uniqid(time()); symlink(TEST_FILE1, $tmp_link_name); rename($tmp_link_name, TEST_LINK); // reading this link/file file_get_contents(TEST_LINK); // remove the link (we have the same bug making this link pointing somewhere else) unlink(TEST_LINK); $good_result = ''; // clearstatcache have no effect clearstatcache(); // fetching result, must be empty (link does not exist) $result = @file_get_contents(TEST_LINK); // on bogus php it return TEST_FILE1 content echo "TEST : " . (($result == $good_result) ? 'SUCCEED' : 'FAILED') . "\n"; echo "result : '" . $result . "' | "; echo "expected : '" . $good_result . "'\n"; echo "php version : " . PHP_VERSION."\n"; echo "realpath_cache_size (if available) : " . @ini_get('realpath_cache_size') . "\n"; // cleaning @unlink(TEST_LINK); unlink(TEST_FILE1); ?> Previous Comments: ------------------------------------------------------------------------ [2006-11-03 12:07:58] p at damezin dot com new summary (perhaps it would make this bug more interesting...) Bug on 5.2.0 is verified with default configuration (without php.ini) and sources provided from php.net (no patch from a portage). ------------------------------------------------------------------------ [2006-11-03 12:00:15] p at damezin dot com still have this problem on 5.2. ------------------------------------------------------------------------ [2006-10-12 22:00:43] p at damezin dot com still have this problem on 5.1.6 ------------------------------------------------------------------------ [2006-10-12 21:57:35] p at damezin dot com Still have this problem on 5.1.4 ------------------------------------------------------------------------ [2006-02-28 11:22:30] p at damezin dot com It's the same with clearstatcache(), this is why you can see it comment in the testcase. It have no influence. ------------------------------------------------------------------------ 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 http://bugs.php.net/36555 -- Edit this bug report at http://bugs.php.net/?id=36555&edit=1