Bug #55327 [Opn->Bgs]: mktime produces different results with different formats
| From: | rasmus@php.net | Date: | Sun, 31 Jul 2011 06:34:19 +0000 |
| Subject: | Bug #55327 [Opn->Bgs]: mktime produces different results with different formats | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-162305@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55327&edit=1
ID: 55327
Updated by: rasmus@php.net
Reported by: ahemphill at clickbusinessservices dot com
Summary: mktime produces different results with different
formats
-Status: Open
+Status: Bogus
Type: Bug
Package: Date/time related
Operating System: Linux
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
Numbers with leading 0's are octal. 08 is an invalid value. See
http://php.net/integer
Previous Comments:
------------------------------------------------------------------------
[2011-07-31 06:27:08] ahemphill at clickbusinessservices dot com
Description:
------------
For August 1, 2011, mktime produces different results based on the input format of the month
parameter. Sounds goofy, yes.
But calculations based on whether the Aug 1 date is in the future or past may fail if a leading zero
is entered for the month.
Test script:
---------------
echo 'mktime (0,0,0,8,01,2011) = '.mktime (0,0,0,8,01,2011). '<br />';
echo 'mktime (0,0,0,08,01,2011) = '.mktime (0,0,0,08,01,2011). '<br />';
echo 'mktime (0,0,0,7,01,2011) = '.mktime (0,0,0,7,01,2011). '<br />';
echo 'mktime (0,0,0,07,01,2011) = '.mktime (0,0,0,07,01,2011). '<br />';
Expected result:
----------------
mktime (0,0,0,8,01,2011) = 1312171200
mktime (0,0,0,08,01,2011) = 1312171200
mktime (0,0,0,7,01,2011) = 1309492800
mktime (0,0,0,07,01,2011) = 1309492800
Actual result:
--------------
mktime (0,0,0,8,01,2011) = 1312171200
mktime (0,0,0,08,01,2011) = 1291179600 <- value is too small
mktime (0,0,0,7,01,2011) = 1309492800
mktime (0,0,0,07,01,2011) = 1309492800
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55327&edit=1