Bug #36555 [Nab]: realpath_cache never updated with symlinks (removed or renamed)

From: Date: Fri, 07 Sep 2012 17:16:40 +0000
Subject: Bug #36555 [Nab]: realpath_cache never updated with symlinks (removed or renamed)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-173239@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=36555&edit=1

 ID:                 36555
 Updated by:         laruence@php.net
 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:

I can not reproduce this. 

could you explain your test steps?


Previous Comments:
------------------------------------------------------------------------
[2012-09-07 16:11:32] webmaster at wininup dot com

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).

------------------------------------------------------------------------
[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

------------------------------------------------------------------------


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


Thread (17 messages)

« previous php.bugs (#173239) next »