php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36027 mktime(0,0,0,0,0,0) not returning FALSE
Submitted: 2006-01-16 04:36 UTC Modified: 2006-01-16 08:02 UTC
From: rocco at suqueensland dot org dot au Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.1.2 OS: Windows XP
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: rocco at suqueensland dot org dot au
New email:
PHP Version: OS:

 

 [2006-01-16 04:36 UTC] rocco at suqueensland dot org dot au
Description:
------------
mktime function returns an incorrect unix timestamp when the arguments are invalid. The changelog states "Made the function return FALSE on error, instead of -1."

Reproduce code:
---------------
echo mktime(0,0,0,0,0,0);

Expected result:
----------------
false

Actual result:
--------------
943880400

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-16 04:39 UTC] rocco at suqueensland dot org dot au
(forgot to change the summary after i checked the changelog for the return value changing)
 [2006-01-16 07:49 UTC] derick@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 -r "echo date('Y-m-d H:i:s', mktime(0,0,0,0,0,0) );"

echos:
1999-11-30 00:00:00

Which is correct...
 [2006-01-16 07:50 UTC] derick@php.net
Tue, 30 Nov 1999 00:00:00 CET is what it shows even.
 [2006-01-16 08:02 UTC] rocco at suqueensland dot org dot au
Thats not exactly returning a false is it? Its generating a date so when you then look at it you're getting a false impression. (ie a default entry in a mysql database set to 0000-00-00 00:00:00 and you create a PEAR Date object based on that date, and instead of getting -1 or false, you'd get 1999-11-30 00:00:00)

Before 5.1.0 it would return a -1 which meant you'd know something was wrong/or it hadn't been set to something.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 04:01:29 2024 UTC