ID:               26011
 Updated by:       [EMAIL PROTECTED]
 Reported By:      final at solnet dot ch
-Status:           Open
+Status:           Bogus
 Bug Type:         Filesystem function related
 Operating System: SuSE Linux 8.2
 PHP Version:      4.3.3
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

stat() calls, which filemtime uses internally are cached for
performance reasons. Therefor you should use clearstatcache() before
each filemtime() call to clear the cache.


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

[2003-10-27 16:09:12] final at solnet dot ch

Description:
------------
ok, i've written a "watcher-tool" for my /var/log/mail, which is a
syslog-file (for pop-before-smtp with sendmail, but this doesn't
matter). i have a never ending do-while with a sleep of 4 seconds, and
i use filemtime to see if something changed in /var/log/mail. well, the
problem was, the script never went through even if the file got changed
(i've checked that with ls -l many times...). only if you get filemtime
of another file between two filemtimes of /var/log/mail, php noticed
that the file modification time changed.

well, but if you edit the file by an editor, php does notice it. first
i thought, its a matter of syslog-daemon, but since i tried to use
filemtime on another file between two checks of /var/log/mail, im not
sure anymore...

Reproduce code:
---------------
#!/usr/local/php/bin/php
<?php
$file = "/var/log/mail";
$filemtime = filemtime($file);
do
{
        sleep(3);
        echo "not out yet!";
} while (filemtime($file) == $filemtime);
// you'll never get out, even if the log-file gets changed :)
echo "im out (but this will never happen :p)";
?>

Expected result:
----------------
Get out of do ... while as soon as
sendmail/postfix/qpopper/ipopd/whatever writes something to your
/var/log/mail

Actual result:
--------------
you won't get out :p


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


-- 
Edit this bug report at http://bugs.php.net/?id=26011&edit=1

Reply via email to