From: berthier at imcce dot fr
Operating system: ArchLinux, CentOS (x86_64)
PHP version: 5.2.9
PHP Bug Type: *Calendar problems
Bug description: strtotime(JD) provides wrong timestamp for some JD
Description:
------------
For the first 365 days of each millennium, the function strtotime()
applied on a Julian Day provides a Unix timestamp whereas it should not.
Moreover, the Unix timestamp is wrong and always ranges between
110638652400 and 110670188400.
This bug exists for php 5.2.9 on ArchLinux 2009-02 kernel 2.6.28 x86_64
and also for php 5.2.6 on CentOS 5.2 kernel 2.6.18 x86_64. It does not
exist for php 5.2.6 on OpenSuse 11.1 kernel 2.6.27 i686.
Reproduce code:
---------------
<?php
$epoch_0 = 2400000.5476;
for ($i=0; $i<=100000; $i++) {
$epoch = $epoch_0 + $i;
if (($timestamp = strtotime($epoch)) === FALSE) {
echo $epoch." == not a timestamp!\n";
} else {
echo $epoch." == timestamp = ".$timestamp." ; JD =
".unixtojd($timestamp)."\n";
}
}
?>
Expected result:
----------------
2400000.5476 == not a timestamp!
2400001.5476 == not a timestamp!
2400002.5476 == not a timestamp!
...
2400365.5476 == not a timestamp!
2400366.5476 == not a timestamp!
2400367.5476 == not a timestamp!
Actual result:
--------------
2400000.5476 == not a timestamp!
2400001.5476 == timestamp = 110638652400 ; JD = 3721128
2400002.5476 == timestamp = 110638738800 ; JD = 3721129
...
2400365.5476 == timestamp = 110670102000 ; JD = 3721492
2400366.5476 == timestamp = 110670188400 ; JD = 3721493
2400367.5476 == not a timestamp!
--
Edit bug report at http://bugs.php.net/?id=47723&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=47723&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=47723&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=47723&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=47723&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=47723&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=47723&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=47723&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=47723&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=47723&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=47723&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=47723&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=47723&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=47723&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=47723&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47723&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47723&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=47723&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=47723&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=47723&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=47723&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=47723&r=mysqlcfg