Edit report at https://bugs.php.net/bug.php?id=55327&edit=1
ID: 55327 Updated by: ras...@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