Bug #55327 [NEW]: mktime produces different results with different formats
| From: | ahemphill at clickbusinessservices dot com | Date: | Sun, 31 Jul 2011 06:27:08 +0000 |
| Subject: | Bug #55327 [NEW]: mktime produces different results with different formats | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-162304@lists.php.net to get a copy of this message | ||
From:
Operating system: Linux
PHP version: 5.3.6
Package: Date/time related
Bug Type: Bug
Bug description:mktime produces different results with different formats
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 bug report at https://bugs.php.net/bug.php?id=55327&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55327&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55327&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55327&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=55327&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55327&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=55327&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=55327&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=55327&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=55327&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=55327&r=support
Expected behavior: https://bugs.php.net/fix.php?id=55327&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=55327&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=55327&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=55327&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55327&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=55327&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=55327&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=55327&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=55327&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=55327&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=55327&r=mysqlcfg