#44005 [Opn->Bgs]: mktime invalid return value

From: Date: Fri, 07 Nov 2008 13:14:14 +0000
Subject: #44005 [Opn->Bgs]: mktime invalid return value
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-1441@lists.php.net to get a copy of this message
ID: 44005 Updated by: vrana@php.net Reported By: felixl at densi dot com -Status: Open +Status: Bogus Bug Type: Documentation problem Operating System: win XP SP2 PHP Version: Irrelevant New Comment: 69 maps to 2069 which is out of range. There's no conflict. Previous Comments: ------------------------------------------------------------------------ [2008-01-31 20:11:12] derick@php.net mktime/strtotime still return an signed integer. If you're on 32bits, this makes the range limited to 1901-2038. There are how ever other functions that always support larger ranges. It's all the functions that deal with the DateTime class. I don't agree with your statement though that the docs specify that it supports up to 2069 on 32 bit machines... because "On systems where time_t is a 32bit signed integer, as most common today, the valid range for year is somewhere between 1901 and 2038." ------------------------------------------------------------------------ [2008-01-31 19:31:08] felixl at densi dot com Description: ------------ The doc of mktime says this: 'Before PHP 5.1.0, negative timestamps were not supported under any known version of Windows and some other systems as well. Therefore the range of valid years was limited to 1970 through 2038.' This text also means this: php version higher then 5.1.0 can have a greater range then 1970 through 2038. Also, in the doc: 'The number of the year, may be a two or four digit value, with values between 0-69 mapping to 2000-2069 and 70-100 to 1970-2000. On systems where time_t is a 32bit signed integer, as most common today, the valid range for year is somewhere between 1901 and 2038. However, before PHP 5.1.0 this range was limited from 1970 to 2038 on some systems (e.g. Windows).' Which clearly specify that date as high as 2069 are possible. Strange because a date in 2050 doesn't work. 2 possibles solution: - correct the bug - change the doc Reproduce code: --------------- $year = 2050; $month = 10; $day = 17; $hour = 10; $min = 32; $sec = 0; $valid = mktime($hour, $min, $sec, $month, $day, $year); print $valid; Expected result: ---------------- a valid timestamp Actual result: -------------- false ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44005&edit=1

« previous php.doc.bugs (#1441) next »