php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2415 filectime reports wrong time after Sep 1999. Possible overflow
Submitted: 1999-10-01 00:38 UTC Modified: 1999-10-02 21:55 UTC
From: signal11 at mediaone dot net Assigned: jah (profile)
Status: Closed Package: Misbehaving function
PHP Version: 3.0.9 OS: Linux/Redhat 6.0
Private report: No CVE-ID: None
 [1999-10-01 00:38 UTC] signal11 at mediaone dot net
<?php
        $mod_time=date("D M d, Y",filectime("/home/httpd/html/" . $PHP_SELF));
        echo "<FONT COLOR=\"#BBBBBB\">Last modified: $mod_time</FONT>\n";
?>
Above is the offending code.  When passed the below file, it prints:
Last modified: Wed Dec 31, 1969"

-rw-r--r--   1 bojay   users        1954 Sep 30 23:22 index.php3

Changing the filesize or timestamp past about Sep 29 doesn't seem to do anything - it's permanently locked at Dec 31, 1969.  It's anybody's guess why.. but I suspect somebody didn't allocate enough bytes for the epoch value (If memory serves, it's an unsigned long double) and now it's bit them in the ass. :\

Just so you are sure it isn't my system:

23:37:32
vortex:~$ ssh bofh "date"
Thu Sep 30 23:37:38 CDT 1999



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-10-02 21:53 UTC] jah at cvs dot php dot net
If you change the second line to:
$mod_time=date("D M d H:i:s, Y",filectime("/home/httpd/html/" . $PHP_SELF));
the result should be 'Last modified: Wed Dec 31 18:00:00, 1969', which is
mysteriously 6 six hours before the epoch, just like your timezone is 6 hours
off from GMT.

What's happening here is that for some reason, filectime() can't stat your file
and returns false, which in this context is 0 (the epoch).

Check that the directory path is really right and try 'echo $PHP_SELF' too,
and check your server logs for errors. The problem is somewhere else than
in PHP.
 [1999-10-02 21:55 UTC] jah at cvs dot php dot net
Forgot to close...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 21 22:01:32 2024 UTC