Bug #71913 [NEW]: extra hour in DateTime modify (Daylight Saving Time problem)

From: Date: Tue, 29 Mar 2016 09:07:15 +0000
Subject: Bug #71913 [NEW]: extra hour in DateTime modify (Daylight Saving Time problem)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200199@lists.php.net to get a copy of this message
From: public at RTLer dot com Operating system: Ubuntu 14.04.4 LTS (GNU/Linux 3. PHP version: 7.0.4 Package: Date/time related Bug Type: Bug Bug description:extra hour in DateTime modify (Daylight Saving Time problem) Description: ------------ i use php library "Carbon/Carbon" witch use DateTime directly and when i add one day to this exact day "2016-03-20" with timezone of "Asia/Tehran" it give one extra hour but when i add two day it works just fine. Test script: --------------- $timezone = new DateTimeZone('Asia/Tehran'); $dayStart = new DateTime('2016-03-20 00:00:00.000000', $timezone); $dayOne = (new DateTime('2016-03-20 00:00:00.000000', $timezone))->modify('1 day'); $dayTwo = (new DateTime('2016-03-20 00:00:00.000000', $timezone))->modify('2 day'); echo json_encode([ '$dayStart' => $dayStart, '$dayOne' => $dayOne, 'diff of $dayOne' => $dayStart->diff($dayOne,true), '$dayTwo' => $dayTwo, 'diff of $dayTwo' => $dayStart->diff($dayTwo,true), ]); die; Expected result: ---------------- { "$dayStart": { "date": "2016-03-20 00:00:00.000000", "timezone_type": 3, "timezone": "Asia\/Tehran" }, "$dayOne": { "date": "2016-03-21 00:00:00.000000", "timezone_type": 3, "timezone": "Asia\/Tehran" }, "diff of $dayOne": { "y": 0, "m": 0, "d": 1, "h": 0, "i": 0, "s": 0, "weekday": 0, "weekday_behavior": 0, "first_last_day_of": 0, "invert": 0, "days": 1, "special_type": 0, "special_amount": 0, "have_weekday_relative": 0, "have_special_relative": 0 }, "$dayTwo": { "date": "2016-03-22 00:00:00.000000", "timezone_type": 3, "timezone": "Asia\/Tehran" }, "diff of $dayTwo": { "y": 0, "m": 0, "d": 2, "h": 0, "i": 0, "s": 0, "weekday": 0, "weekday_behavior": 0, "first_last_day_of": 0, "invert": 0, "days": 2, "special_type": 0, "special_amount": 0, "have_weekday_relative": 0, "have_special_relative": 0 } } Actual result: -------------- { "$dayStart": { "date": "2016-03-20 00:00:00.000000", "timezone_type": 3, "timezone": "Asia\/Tehran" }, "$dayOne": { "date": "2016-03-21 01:00:00.000000", "timezone_type": 3, "timezone": "Asia\/Tehran" }, "diff of $dayOne": { "y": 0, "m": 0, "d": 1, "h": 1, "i": 0, "s": 0, "weekday": 0, "weekday_behavior": 0, "first_last_day_of": 0, "invert": 0, "days": 1, "special_type": 0, "special_amount": 0, "have_weekday_relative": 0, "have_special_relative": 0 }, "$dayTwo": { "date": "2016-03-22 00:00:00.000000", "timezone_type": 3, "timezone": "Asia\/Tehran" }, "diff of $dayTwo": { "y": 0, "m": 0, "d": 2, "h": 0, "i": 0, "s": 0, "weekday": 0, "weekday_behavior": 0, "first_last_day_of": 0, "invert": 0, "days": 2, "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=71913&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71913&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71913&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71913&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=71913&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=71913&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=71913&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=71913&r=needscript Try newer version: https://bugs.php.net/fix.php?id=71913&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=71913&r=support Expected behavior: https://bugs.php.net/fix.php?id=71913&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=71913&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=71913&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=71913&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71913&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=71913&r=dst IIS Stability: https://bugs.php.net/fix.php?id=71913&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=71913&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=71913&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=71913&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=71913&r=mysqlcfg

« previous php.bugs (#200199) next »