note 53882 added to function.fwrite
| From: | leemansbart at hotmail dot com | Date: | Thu, 16 Jun 2005 01:55:49 +0000 |
| Subject: | note 53882 added to function.fwrite | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90499@lists.php.net to get a copy of this message | ||
I think there is a tiny delay in writing to the file...
It took me +- 7 hours unitl I found this error (nut a bug actually).
I'm working on a site where you first write the status to a file, and then let other functions
check the status.
The problem is, that when you refresh the site prety fast or have a lot of users on it, it gives an
error when parsing the data in the file.
I did use the "fclose($file);" command, and checked very thourougly that it did come from
the writing to the status file.
I also execute is_writable($file) or is_readable($file) in every function that requires it when
calling the file.
The only possible solution I seem o find is to update the status less, every 60 sec or so, and call
the sleep(1); command to let the script wait for the file to be written.
My best guess is that this error appears because of the Windows cache ? (I write a new file, not
appending to the previous one.)
----
Manual Page -- http://www.php.net/manual/en/function.fwrite.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53882
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53882&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53882&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53882&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53882&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+53882&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53882&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53882&report=yes
Search -- http://master.php.net/manage/user-notes.php