php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49466 Gtk::timeout_add updates "date" function but not "filesize"
Submitted: 2009-09-04 10:36 UTC Modified: 2009-09-05 22:32 UTC
From: willgriffiths1 at yahoo dot co dot uk Assigned:
Status: Not a bug Package: PHP-GTK related
PHP Version: 5.3.0 OS: Windows Vista
Private report: No CVE-ID: None
 [2009-09-04 10:36 UTC] 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
...


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-05 12:08 UTC] 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-05 16:19 UTC] willgriffiths1 at yahoo dot co dot uk
Thank you for the quick response and clear explanation.
 [2009-09-05 22:32 UTC] auroraeosrose@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC