php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #2155 amusing interaction between date() and filemtime(), when filemtime() is false
Submitted: 1999-08-25 17:24 UTC Modified: 2001-02-10 13:40 UTC
From: seth at psy dot au dot dk Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 3.0.12 OS: Linux 2.2.5
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: seth at psy dot au dot dk
New email:
PHP Version: OS:

 

 [1999-08-25 17:24 UTC] seth at psy dot au dot dk
The following code fragment should be self-explanatory

$dbtime=date("d-m-Y", filemtime("/var/lib/mysql/sample/DBase.ISD"));
print "(Databases last updated: " . $dbtime . ")\n"

Recently I moved the script to another machine, where the file named
in filemtime did not exist.

The result:

(Databases last updated: 01-01-1970)

No big deal.  But maybe date() should respond to whatever
filemtime() returns ( "false" according to the man page) with
an error message.

Cheers,
  Seth

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-10 13:40 UTC] jimw@php.net
date takes an int, false gets converted to 0, and that is 1.1.1970.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 10 00:01:28 2024 UTC