php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81107 Regression in 8.1: sorting dates differ from > operator
Submitted: 2021-06-04 22:45 UTC Modified: 2022-05-13 15:48 UTC
Votes:3
Avg. Score:3.3 ± 1.7
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: kylekatarnls at gmail dot com Assigned: derick (profile)
Status: Wont fix Package: Date/time related
PHP Version: master-Git-2021-06-04 (Git) OS: Ubuntu
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
18 + 22 = ?
Subscribe to this entry?

 
 [2021-06-04 22:45 UTC] kylekatarnls at gmail dot com
Description:
------------
Previously (PHP 7.4 and 8.0) when a date with year = PHP_INT_MAX were > to a date with any lower year, it was convenient to represent an absolute maximum. And it was rather expected.

Now in 8.1 (latest on GitHub Actions), it became lower.

Test script:
---------------
var_dump(
    (new DateTimeImmutable('2000-12-31 23:59:59.999999'))->setDate(PHP_INT_MAX, 12, 31) >
    new DateTimeImmutable('2019-01-26 10:30:12.000000')
);

Expected result:
----------------
true

Actual result:
--------------
false

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-06-04 22:53 UTC] kylekatarnls at gmail dot com
Maximum year before it start failing is 1732385841753851055
 [2021-06-09 18:35 UTC] patrickallaert@php.net
-Assigned To: +Assigned To: derick
 [2022-05-13 15:48 UTC] derick@php.net
-Status: Assigned +Status: Wont fix
 [2022-05-13 15:48 UTC] derick@php.net
IMO this is an issue of: crap in, crap out. PHP does not support years in that range.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 22:01:29 2024 UTC