#49466 [Opn]: Gtk::timeout_add updates "date" function but not "filesize"
[email protected] ("willgriffiths1 at yahoo dot co dot uk") Sat, 5 Sep 2009 16:19:58 GMT
| Newsgroups | php.gtk.dev |
|---|---|
| Message-ID | <[email protected]> |
ID: 49466
User updated by: willgriffiths1 at yahoo dot co dot uk
Reported By: willgriffiths1 at yahoo dot co dot uk
Status: Open
Bug Type: PHP-GTK related
Operating System: Windows Vista
PHP Version: 5.3.0
New Comment:
Thank you for the quick response and clear explanation.
Previous Comments:
------------------------------------------------------------------------
[2009-09-05 12:08:53] Keisial at gmail dot com
That's not a problem with PHP-GTK, but with filesize() function of PHP.
And yes, this is intentional. You need to call clearstatcache() between
filesize()s to see the changes.
http://php.net/filesize
"Note: The results of this function are cached. See clearstatcache()
for more details."
http://php.net/manual/en/function.clearstatcache.php
"When you use stat(), lstat(), or any of the other functions listed in
the affected functions list (below), PHP caches the information those
functions return in order to provide faster performance. However, in
certain cases, you may want to clear the cached information. For
instance, if the same file is being checked multiple times within a
single script, and that file is in danger of being removed or changed
during that script's operation, you may elect to clear the status
cache."
------------------------------------------------------------------------
[2009-09-04 10:36:48] willgriffiths1 at yahoo dot co dot uk
Description:
------------
I put PHP 5.3 because it made me pick a version. I'm actually using
PHP-GTK2.
The function in the example given echos the 'date' and the 'filesize'
every 3 seconds.
However, while the date updates correctly (+3 seconds each time), the
filesize stays the same even if you increase the size of the file.
Is this expected behaviour?
Reproduce code:
---------------
Gtk::timeout_add(3000, 'update', $store);
function update($store) {
$offset = filesize('file.txt') - 100;
echo $offset." ".date('H:i:s')."\r\n";
}
Expected result:
----------------
195382 11:18:06
195387 11:18:09
195399 11:18:12
...
Actual result:
--------------
195380 11:18:06
195380 11:18:09
195380 11:18:12
...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49466&edit=1