mirror of
https://github.com/php/php-src.git
synced 2024-12-11 19:04:38 +08:00
- Fixed bug #52062: large timestamps with DateTime::getTimestamp and DateTime::setTimestamp.
This commit is contained in:
parent
300b3efff5
commit
2679ccc50b
@ -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;
|
||||
|
@ -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;
|
||||
|
21
ext/date/tests/bug52062.phpt
Normal file
21
ext/date/tests/bug52062.phpt
Normal 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"
|
Loading…
Reference in New Issue
Block a user