xref: /PHP-7.2/ext/date/tests/bug52062.phpt (revision f1d7e3ca)
1--TEST--
2Bug #52062 (large timestamps with DateTime::getTimestamp and DateTime::setTimestamp) (32 bit)
3--SKIPIF--
4<?php
5if (PHP_INT_SIZE != 4) die('skip 32-bit only');
6?>
7--INI--
8date.timezone=UTC
9--FILE--
10<?php
11$d = new DateTime('@100000000000');
12var_dump($d->format('Y-m-d H:i:s U'));
13var_dump($d->getTimestamp());
14var_dump($d->format('U'));
15
16$d->setTimestamp(100000000000);
17var_dump($d->format('Y-m-d H:i:s U'));
18var_dump($d->getTimestamp());
19
20$i = new DateInterval('PT100000000000S');
21var_dump($i->format('%s'));
22?>
23--EXPECTF--
24string(32) "5138-11-16 09:46:40 100000000000"
25bool(false)
26string(12) "100000000000"
27
28Warning: DateTime::setTimestamp() expects parameter 1 to be integer, float given in %s on line %d
29string(32) "5138-11-16 09:46:40 100000000000"
30bool(false)
31string(10) "1215752192"
32