weird bug with large integers in DateTime::from

5 years ago

bazo
Member | 625
+
0
-

so i encountered this weird bug, it's not a nette but more a php bug

the following snippet of code

<?php
$this->res->setExpiration(PHP_INT_MAX);
?>

works just fine on my localhost win8.1, php 5.5.4 x64. PHP_INT_MAX = 2147483647 which is coincidentally the max value of timestamp.

on the server(debian 7, PHP 5.5.12–1~dotdeb.1) however the value of PHP_INT_MAX = 9223372036854775807

which leads to this exception DateTime::__construct(): Failed to parse time string (-292277022657–01–27 09:29:51) at position 11 (5): Double date specification

the problem is that on DateTime.php:47 the var $time is considered to be an instanceof \DateTime