- Fixed bug #52062: large timestamps with DateTime::getTimestamp and DateTime::setTimestamp.

This commit is contained in:
Derick Rethans 2011-12-06 06:04:24 +00:00
parent 300b3efff5
commit 2679ccc50b
3 changed files with 24 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* Generated by re2c 0.13.5 on Sat Nov 13 14:57:59 2010 */
/* Generated by re2c 0.13.5 on Mon Dec 5 22:02:31 2011 */
#line 1 "ext/date/lib/parse_iso_intervals.re"
/*
+----------------------------------------------------------------------+
@ -396,7 +396,7 @@ yy6:
break;
}
nr = timelib_get_unsigned_nr((char **) &ptr, 9);
nr = timelib_get_unsigned_nr((char **) &ptr, 12);
switch (*ptr) {
case 'Y': s->period->y = nr; break;
case 'W': s->period->d = nr * 7; break;

View File

@ -364,7 +364,7 @@ isoweek = year4 "-"? "W" weekofyear;
break;
}
nr = timelib_get_unsigned_nr((char **) &ptr, 9);
nr = timelib_get_unsigned_nr((char **) &ptr, 12);
switch (*ptr) {
case 'Y': s->period->y = nr; break;
case 'W': s->period->d = nr * 7; break;

View File

@ -0,0 +1,21 @@
--TEST--
Bug #52062: large timestamps with DateTime::getTimestamp and DateTime::setTimestamp
--FILE--
<?php
$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'));
?>
--EXPECT--
string(32) "5138-11-16 09:46:40 100000000000"
int(100000000000)
string(32) "5138-11-16 09:46:40 100000000000"
int(100000000000)
string(12) "100000000000"