Edit report at https://bugs.php.net/bug.php?id=36555&edit=1
ID: 36555
Comment by: webmaster at wininup 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:
Why is this bug report not considered like a real bug ? It is because it's not
at
all the behavior expected : file_get_contents() randomly the content delivered
is
the the new symlink or from the old symlink content !!
Still occurs on PHP 5.4.6 (Linux Fedora 17).
Previous Comments:
------------------------------------------------------------------------
[2006-11-03 12:37:08] p at damezin dot com
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);
?>
------------------------------------------------------------------------
[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
------------------------------------------------------------------------
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