#49466 [Opn->Bgs]: Gtk::timeout_add updates "date" function but not "filesize"

[email protected] Sat, 5 Sep 2009 22:32:24 GMT
Newsgroups php.gtk.dev
Message-ID <[email protected]>
 ID:               49466
 Updated by:       [email protected]
 Reported By:      willgriffiths1 at yahoo dot co dot uk
-Status:           Open
+Status:           Bogus
 Bug Type:         PHP-GTK related
 Operating System: Windows Vista
 PHP Version:      5.3.0
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.




Previous Comments:
------------------------------------------------------------------------

[2009-09-05 16:19:58] willgriffiths1 at yahoo dot co dot uk

Thank you for the quick response and clear explanation.

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

[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