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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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: Sat May 04 22:01:33 2024 UTC