Bug #77571 [NEW]: DateInterval timezone bug
From: techouse at gmail dot com
Operating system: macOS 10.14.3, Ubuntu 18.04
PHP version: 7.3.1
Package: Date/time related
Bug Type: Bug
Bug description:DateInterval timezone bug
Description:
------------
Yesterday I observed a weird DateInterval bug where adding 5 weeks would
always equal 35 days but the difference in months and days would not be
correct.
After some digging I figured out it was related to timezones and only
affected timezones ranging from Europe/London eastward all the way to
Pacific/Auckland, however as soon as I used Pacific/Honolulu the issue
was gone.
Test findings
All the tests in tests/Timezones/America and tests/Timezones/Atlantic
pass. Another weird thing is that Europe/London passes all tests where
it does not adhere to daylight savings time (UTC+01:00).
From this I draw a conclusion that all timezones that are greater than
UTC+00:00 fail because of this additional time.
All the tests and findings can be found in my GitHub repo
https://github.com/techouse/php-date-interval-timezone-bug
Test script:
---------------
https://github.com/techouse/php-date-interval-timezone-bug
Expected result:
----------------
A correct DateInterval.
--
Edit bug report at https://bugs.php.net/bug.php?id=77571&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77571&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77571&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77571&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77571&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77571&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77571&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77571&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77571&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77571&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77571&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77571&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77571&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77571&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77571&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77571&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77571&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77571&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77571&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77571&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77571&r=mysqlcfg
Thread (11 messages)
- techouse at gmail dot com
- techouse at gmail dot comBug #77571 [Opn]: DateInterval reports incorrect interval when when a UTC+01:00 or greater is used
- techouse at gmail dot comBug #77571 [Opn]: DateInterval has incorrect interval using timezones from UTC+01:00 to UTC+12:00
- techouse at gmail dot comBug #77571 [Opn]: DateInterval has incorrect interval using timezones from UTC+01:00 to UTC+12:00
- a at b dot c dot deBug #77571 [Com]: DateInterval has incorrect interval using timezones from UTC+01:00 to UTC+12:00
- techouse at gmail dot comBug #77571 [Opn]: DateInterval has incorrect interval using timezones from UTC+01:00 to UTC+12:00
- techouse at gmail dot comBug #77571 [Opn]: DateTime's diff DateInterval incorrect in timezones from UTC+01:00 to UTC+12:00
- techouse at gmail dot comBug #77571 [Com]: DateTime's diff DateInterval incorrect in timezones from UTC+01:00 to UTC+12:00
- cmb@php.netBug #77571 [Opn]: DateTime's diff DateInterval incorrect in timezones from UTC+01:00 to UTC+12:00
- techouse at gmail dot comBug #77571 [Com]: DateTime's diff DateInterval incorrect in timezones from UTC+01:00 to UTC+12:00
- derick@php.netBug #77571 [Opn->Csd]: DateTime's diff DateInterval incorrect in timezones from UTC+01:00 to UTC+12:00