PHP 4.0 Bug #8002 Updated: PHP caches files opened with file().
| From: | stas@php.net | Date: | Tue, 28 Nov 2000 11:51:12 +0000 |
| Subject: | PHP 4.0 Bug #8002 Updated: PHP caches files opened with file(). | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-39378@lists.php.net to get a copy of this message | ||
ID: 8002
Updated by: stas
Reported By: brett_paul@mindspring.com
Status: Closed
Bug Type: Directory function related
Assigned To:
Comments:
PHP does not cache results of file(), but your browser
probably caches results of your page. Try to disable caching
in your browser.
Previous Comments:
---------------------------------------------------------------------------
[2000-11-28 01:03:28] brett_paul@mindspring.com
I have a page that I am using to edit files on my site. I read the file using file() and show it in
a textarea. I save changes to the file. Upon reloading the page, it does not reflect those changes
in the newly presented HTML page (even with a hard refresh), but the underlying file was changed
successfully (verified this). Seems to be caching file() reads. A call to clearstatcache() does not
clear this. Getting an error seems to clear it, however.
Here's the code. $filename is posted from an HTML form:
<?
if (!isset($filename)) {
$sLocation = dirname($HTTP_REFERER)."index.html";
header("location:$sLocation");
}
$filename = "c:\xitami\webpages\".$filename;
echo "<HTML>n<head><title>Edit file $filename
</title></head>n";
echo "<body bgcolor="eadfdf" basefont size=4>n";
if (!isset($new)) {
$new = FALSE;
}
echo "<form action="savefile.php" method="post">n";
if ($new == TRUE) {
echo "Filename: <input name="filename"
length="30"><br>n";
$contents = "";
} else {
echo "Filename: $filename<input name="filename" type="hidden"
value="$filename"><br>n";
clearstatcache();
$contents = file($filename);
$contents = implode($contents, "");
}
$contents = stripcslashes($contents);
echo "<textarea name="contents" cols=75 rows=20
wrap="hard">$contents</textarea>n";
echo "<input type="submit" value="save">n";
echo "</form>n";
?>
</body>
</html>
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=8002