#48458 [NEW]: mktime produces huge negative numbers
From: post at oliver-schieche dot de
Operating system: Debian 4 2.6.18-6-amd64
PHP version: 5.2.9
PHP Bug Type: Date/time related
Bug description: mktime produces huge negative numbers
Description:
------------
Trying to get mktime to create a timestamp for today at 00:00 hours, odd
results are returned. Previous versions of PHP 5 returned a correct
timestamp even without adding 1900 to the year.
This change to mktime behavior was not documented in the ChangeLog.
Reproduce code:
---------------
$v = localtime(time(), TRUE);
$tm1 = mktime(0, 0, 0, $v['tm_mon']+1, $v['tm_mday'], $v['tm_year']);
$tm2 = mktime(0, 0, 0);
Expected result:
----------------
tm1 == tm2 == 1243980000 // 2009-06-03 00:00:00
Actual result:
--------------
tm1 = -58714246800
tm2 = 1243980000
--
Edit bug report at http://bugs.php.net/?id=48458&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48458&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48458&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48458&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=48458&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48458&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=48458&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=48458&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=48458&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=48458&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=48458&r=support
Expected behavior: http://bugs.php.net/fix.php?id=48458&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=48458&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=48458&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=48458&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48458&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48458&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=48458&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=48458&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=48458&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=48458&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=48458&r=mysqlcfg
Thread (4 messages)
- post at oliver-schieche dot de