From:
Operating system: Linux 2.6.35.7 x86_64
PHP version: 5.2.16
Package: Unknown/Other Function
Bug Type: Bug
Bug description:mktime() produces invalid results under 64-bit
Description:
------------
It appears that when the PHP binary was compiled against 64-bit libraries,
mktime() seems to only do minimal error checking of parms. After some
additional
testing, if found the following results:
PHP Code:
$t=mktime(0,0,0,12,3,292277026596);
var_dump($t);
$t=mktime(0,0,0,12,3,292277026597);
var_dump($t);
$t=mktime(900000000000,900000000000,900000000000,900000000000,900000000000,90000
0000000);
var_dump($t);
int(9223372036854655200)
int(-9223372036823360416)
int(-6044405109589065632)
It appears that once the parm value exceeds the value limit of a long var,
the
function returns a negative value. No warnings are produced. Instead of
returning FALSE for an error, the function just returns an invalid result.
Some additional info here: http://phpbuilder.com/board/showthread.php?
p=10971046#post10971046
Test script:
---------------
$t=mktime(0,0,0,12,3,292277026596);
var_dump($t);
$t=mktime(0,0,0,12,3,292277026597);
var_dump($t);
$t=mktime(900000000000,900000000000,900000000000,900000000000,900000000000,900000000000);
var_dump($t);
int(9223372036854655200)
int(-9223372036823360416)
int(-6044405109589065632)
Expected result:
----------------
Return FALSE if parms are invalid.
Actual result:
--------------
Invalid values. Does not return FALSE.
--
Edit bug report at http://bugs.php.net/bug.php?id=53608&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53608&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53608&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53608&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=53608&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53608&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=53608&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=53608&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=53608&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=53608&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=53608&r=support
Expected behavior: http://bugs.php.net/fix.php?id=53608&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=53608&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=53608&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=53608&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53608&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53608&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=53608&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=53608&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=53608&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=53608&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=53608&r=mysqlcfg