You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DateTime diff returns wrong sign on day count when using a timezone (Regression) #9880
Similar difference in ->y value was introduced with PHP 8.1.10 https://3v4l.org/Wiane
It returns -1 instead of 0 when 2 dates with different timezones are compared.
php all
If set $test2 = new \DateTime('2018-03-31 01:00:00', $london); and $test2->diff($test1) it's partial correct with inverter 1, if $test1->diff($test2) is correct
@cmb69 it's great bug exists for function diff (don't only duplicate)
I am for restoring before creating same type timezone of php 8.1.10, adding a note in the manual for this use case otherwise the code needs improvement and I mean if different from same type it uses the same hacks that would be used with timezone type 3 Europe/Rome == Europe/Rome ... it is difficult to rewrite same type for this type of use.
Activity
cmb69 commentedon Nov 3, 2022
Indeed, this look completely wrong.
cmb69 commentedon Nov 3, 2022
This might be a duplicate of #9866.
ayanozturk commentedon Nov 3, 2022
Similar difference in
->yvalue was introduced with PHP 8.1.10https://3v4l.org/Wiane
It returns
-1instead of0when 2 dates with different timezones are compared.hormus commentedon Nov 3, 2022
php >= 8.1.10
php all
If set $test2 = new \DateTime('2018-03-31 01:00:00', $london); and $test2->diff($test1) it's partial correct with inverter 1, if $test1->diff($test2) is correct
php < 8.1.10
if uncomment $dateDiff php < 8.1.10
@cmb69 it's great bug exists for function diff (don't only duplicate)
I am for restoring before creating same type timezone of php 8.1.10, adding a note in the manual for this use case otherwise the code needs improvement and I mean if different from same type it uses the same hacks that would be used with timezone type 3 Europe/Rome == Europe/Rome ... it is difficult to rewrite same type for this type of use.
Fixed phpGH-9699, phpGH-9866, and phpGH-9880 (problems with diff); and …
derickr commentedon Nov 30, 2022
Now fixed, for PHP 8.1.14 and PHP 8.2.1.