#25094 [Opn->Bgs]: rename() function caches a source file info
| From: | iliaa@php.net | Date: | Thu, 14 Aug 2003 16:47:05 +0000 |
| Subject: | #25094 [Opn->Bgs]: rename() function caches a source file info | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-45936@lists.php.net to get a copy of this message | ||
ID: 25094
Updated by: iliaa@php.net
Reported By: naumovic at beotel dot yu
-Status: Open
+Status: Bogus
Bug Type: Filesystem function related
Operating System: Win 2000
PHP Version: 4.3.2
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
The code works properly, after you've renamed the file 'oldFile.txt' no
longer exists, which is why file_exists() returns 0/FALSE.
Previous Comments:
------------------------------------------------------------------------
[2003-08-14 06:53:34] naumovic at beotel dot yu
Description:
------------
When i try to rename a file, then to check if the source file exists,
file_exists() returns me true. A conclusion is that a source file info
is cached when using rename() function.
My solution was to call clearcache() between rename() and
file_exists(). I'm not sure if anyone else will consider it as a bug,
but i suppose it's not a desired behavior.
In the Reproduce code i put casting into integer just for the sake of
displaying 0 if the file doesn't exist instead of an empty string.
Reproduce code:
---------------
rename('oldFile.txt', 'newFile.txt');
echo((int) file_exists('oldFile.txt');
Expected result:
----------------
1
Actual result:
--------------
0
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25094&edit=1