Bug #52062 [NEW]: large timestamps with DateTime::getTimestamp and DateTime::setTimestamp
From:
Operating system: Ubuntu i686 2.6.32-22-generic
PHP version: 5.3.2
Package: Date/time related
Bug Type: Bug
Bug description:large timestamps with DateTime::getTimestamp and DateTime::setTimestamp
Description:
------------
DateTime::getTimestamp(), DateTime::setTimestamp() and DateInterval does
not work
with large timestamps (using numbers over x86 integers)
Test script:
---------------
$d = new DateTime('@100000000000');
var_dump($d->format('Y-m-d H:i:s U'));
var_dump($d->getTimestamp());
$d->setTimestamp(100000000000);
var_dump($d->format('Y-m-d H:i:s U'));
var_dump($d->getTimestamp());
$i = new DateInterval('PT100000000000S');
var_dump($i->format('%s'));
Expected result:
----------------
string(32) "5138-11-16 09:46:40 100000000000"
float(100000000000)
string(32) "5138-11-16 09:46:40 100000000000"
float(100000000000)
string(12) "100000000000"
Actual result:
--------------
string(32) "5138-11-16 09:46:40 100000000000"
bool(false)
string(30) "2008-07-11 04:56:32 1215752192"
int(1215752192)
Exception with message 'DateInterval::__construct(): Unknown or bad format
(PT100000000000S)'
--
Edit bug report at http://bugs.php.net/bug.php?id=52062&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52062&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52062&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52062&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=52062&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52062&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=52062&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=52062&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=52062&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=52062&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=52062&r=support
Expected behavior: http://bugs.php.net/fix.php?id=52062&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=52062&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=52062&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=52062&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52062&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52062&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=52062&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=52062&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=52062&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=52062&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=52062&r=mysqlcfg
Thread (6 messages)
- dan at bnet dot lt