[php-src] Issue #8000: DateTime doesn't correctly parse PHP_INT_MIN timestamp
| From: | cmb69 | Date: | Mon, 31 Jan 2022 17:31:49 +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-239375@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8000
Comment Author: cmb69
The totally wrong PHP 8.0 behavior has been fixed in the latest timelib version, so PHP 8.1 yields
better results; I don't think this fix will be backported. The "slightly" wrong PHP
8.1 behavior is due to
timelib_get_signed_nr() calling
[timelib_get_nr_ex()](https://github.com/derickr/timelib/blob/3183ed6a34a1982bd61577132034aaa36a1bddeb/parse_date.re#L467)
to get the actual number (without the sign), and that function calls strtoull(3) which
saturates to the largest possible positive value. A possible fix would be to let
strtoull(3) parse the sign as well.
Anyhow, this is actually an [upstream issue](https://github.com/derickr/timelib/issues); consider to
report there, but see https://github.com/derickr/timelib/issues/108#issuecomment-820349578.