Bug #71826 [NEW]: DateTime::diff confuse on timezone 'Asia/Tokyo'
| From: | sukobuto at gmail dot com | Date: | Tue, 15 Mar 2016 10:25:29 +0000 |
| Subject: | Bug #71826 [NEW]: DateTime::diff confuse on timezone 'Asia/Tokyo' | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-199832@lists.php.net to get a copy of this message | ||
From: sukobuto at gmail dot com
Operating system: CentOS 6.7
PHP version: 5.6.19
Package: Date/time related
Bug Type: Bug
Bug description:DateTime::diff confuse on timezone 'Asia/Tokyo'
Description:
------------
In some conditions, DateTime::diff makes a mistake on month-section.
For example, the gap of Feb 1 and Mar 1 is 1 month.
But output was "0 month 28 days" in timezone Asia/Tokyo.
("1 month 0 days" in timezone UTC)
Test script:
---------------
https://wandbox.fetus.jp/permlink/zgdq2iE1VuL9zM50
Expected result:
----------------
a: 2015-2-1 <--> 2015-3-1
DateInterval Object
(
[y] => 0
[m] => 1
[d] => 0
[h] => 0
[i] => 0
[s] => 0
[weekday] => 0
[weekday_behavior] => 0
[first_last_day_of] => 0
[invert] => 0
[days] => 28
[special_type] => 0
[special_amount] => 0
[have_weekday_relative] => 0
[have_special_relative] => 0
)
b: 2015-3-1 <--> 2015-3-29
DateInterval Object
(
[y] => 0
[m] => 0
[d] => 28
[h] => 0
[i] => 0
[s] => 0
[weekday] => 0
[weekday_behavior] => 0
[first_last_day_of] => 0
[invert] => 0
[days] => 28
[special_type] => 0
[special_amount] => 0
[have_weekday_relative] => 0
[have_special_relative] => 0
)
c: 2015-4-1 <--> 2015-4-29
DateInterval Object
(
[y] => 0
[m] => 0
[d] => 28
[h] => 0
[i] => 0
[s] => 0
[weekday] => 0
[weekday_behavior] => 0
[first_last_day_of] => 0
[invert] => 0
[days] => 28
[special_type] => 0
[special_amount] => 0
[have_weekday_relative] => 0
[have_special_relative] => 0
)
Actual result:
--------------
a(Asia/Tokyo): 2015-2-1 <--> 2015-3-1
DateInterval Object
(
[y] => 0
[m] => 0
[d] => 28
[h] => 0
[i] => 0
[s] => 0
[weekday] => 0
[weekday_behavior] => 0
[first_last_day_of] => 0
[invert] => 0
[days] => 28
[special_type] => 0
[special_amount] => 0
[have_weekday_relative] => 0
[have_special_relative] => 0
)
b(Asia/Tokyo): 2015-3-1 <--> 2015-3-29
DateInterval Object
(
[y] => 0
[m] => 1
[d] => 0
[h] => 0
[i] => 0
[s] => 0
[weekday] => 0
[weekday_behavior] => 0
[first_last_day_of] => 0
[invert] => 0
[days] => 28
[special_type] => 0
[special_amount] => 0
[have_weekday_relative] => 0
[have_special_relative] => 0
)
c(Asia/Tokyo): 2015-4-1 <--> 2015-4-29
DateInterval Object
(
[y] => 0
[m] => 0
[d] => 28
[h] => 0
[i] => 0
[s] => 0
[weekday] => 0
[weekday_behavior] => 0
[first_last_day_of] => 0
[invert] => 0
[days] => 28
[special_type] => 0
[special_amount] => 0
[have_weekday_relative] => 0
[have_special_relative] => 0
)
--
Edit bug report at https://bugs.php.net/bug.php?id=71826&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71826&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71826&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71826&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71826&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71826&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71826&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71826&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71826&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71826&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71826&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71826&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71826&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71826&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71826&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71826&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71826&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71826&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71826&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71826&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71826&r=mysqlcfg