- π³πΏNew Zealand quietone
@clayfreeman, thanks for pointing this problem out and providing a patch.
This issue is about a problem with PHP 7.3, which is EOL and is not used by a currently supported version of Drupal. Therefore I am closing this issue.
- Status changed to Active
about 1 year ago 12:38pm 28 May 2024 - π¬π§United Kingdom jonathanshaw Stroud, UK
@quietone I don't see any discussion in this issue about whether this is or is not a problem with php 7.4+ or php 8. Maybe it was first reported when php 7.3 was the current version of php. The test coverage provided in the patch would seem useful even if it was not a current problem.
- π¬π§United Kingdom alexpott πͺπΊπ
The problem is that the same date with different langcodes will not compare correctly. PHP's built \DateTime does compare properly and if it was the only property on our DateTimePlus objects then they would compare correctly too. But it's not so that don't and there is nothing we can do about this. I do think we should add a compare method to make things simpler...
Something like:
public function compare(DateTimePlus|\DateTime $datetime2, string $operator): bool { if ($datetime2 instanceof DateTimePlus) { $datetime2 = $datetime2->dateTimeObject; } return match ($operator) { '<' => $this->dateTimeObject < $datetime2, '<=' => $this->dateTimeObject <= $datetime2, '>' => $this->dateTimeObject > $datetime2, '>=' => $this->dateTimeObject >= $datetime2, '==' => $this->dateTimeObject == $datetime2, '!=' => $this->dateTimeObject != $datetime2, }; }
One thing that will catch people out is that if the the dates have the same langcode then object comparison will work as a user expects and therefore I'd guess that we see a lot of date comparison in custom and contrib.
- π«π·France andypost
There's PHP RFC https://wiki.php.net/rfc/drop_32bit_support to drop some date-functions
- πΊπΈUnited States neclimdul Houston, TX
I thought the discussion on the mailing list was to not touch the functions and just drop the 32bit support