Bug #52154 [Opn->Dup]: mktime(0,0,0,0,0,0) returns a timestamp instead of false
| From: | salathe@php.net | Date: | Wed, 23 Jun 2010 09:48:29 +0000 |
| Subject: | Bug #52154 [Opn->Dup]: mktime(0,0,0,0,0,0) returns a timestamp instead of false | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-151798@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52154&edit=1
ID: 52154
Updated by: salathe@php.net
Reported by: j dot logemann at qmulus dot nl
Summary: mktime(0,0,0,0,0,0) returns a timestamp instead of
false
-Status: Open
+Status: Duplicate
Type: Bug
Package: Date/time related
Operating System: Windows 7 enterprise
PHP Version: 5.3.2
New Comment:
This is expected behaviour. Using 0 for the year maps, as documented, to
the year
2000; 0 for the month means December of the previous year (December
1999), 0 for
the day-of-month means the last day of the previous month (30th November
1999).
Therefore your date values do not map to "0000-00-00" as you expected,
but
correctly as you found to "1999-11-30 00:00:00" -- the arguments are not
invalid,
so FALSE is not returned.
Duplicate of bug #36027
Previous Comments:
------------------------------------------------------------------------
[2010-06-23 10:27:35] j dot logemann at qmulus dot nl
Description:
------------
When you try to get the timestamp for day 0 of month 0 of the year 0,
php returns 943916400 instead of false. It should return false because
the input is clearly an invalid date and "0000-00-00" is not equal to
"1999-11-30"
Test script:
---------------
<?php
echo mktime(0,0,0,0,0,0);
Expected result:
----------------
According to the documentation:
"mktime() returns the Unix timestamp of the arguments given. If the
arguments are invalid, the function returns FALSE (before PHP 5.1 it
returned -1)."
Therefore the output should be FALSE and not 943916400
Actual result:
--------------
The actual result = 943916400
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52154&edit=1