[php-src] Issue #8000: DateTime doesn't correctly parse PHP_INT_MIN timestamp

From: Date: Tue, 25 Jan 2022 22:34:48 +0000
Subject: [php-src] Issue #8000: DateTime doesn't correctly parse PHP_INT_MIN timestamp
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-239288@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8000 Author: rybakit ### Description The following code: ```php <?php var_dump(PHP_INT_MIN); var_dump((new DateTime("@-9223372036854775808"))->getTimestamp()); var_dump((new DateTime('-292277022657-01-27 08:29:52 UTC'))->getTimestamp()); ``` Resulted in this output: ``` // Output for 8.1.0 - 8.1.2 int(-9223372036854775808) int(-9223372036854775807) // wrong int(-9223372036854775808) // Output for 8.0.1 - 8.0.15 int(-9223372036854775808) int(-922337203683200587) // wrong int(-922337203683200588) // wrong // Output for 7.4.11 - 7.4.27 int(-9223372036854775808) int(-922337203683200587) // wrong Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (-292277022657-01-27 08:29:52 UTC) at position 11 (5): Double date specification ... ``` But I expected this output instead: ``` int(-9223372036854775808) int(-9223372036854775808) int(-9223372036854775808) ``` See https://3v4l.org/HdgS3. ### PHP Version PHP 7.4, 8.0, 8.1 ### Operating System Linux, MacOS

« previous php.bugs (#239288) next »