bug75167.phpt 613 B

1234567891011121314151617181920
  1. --TEST--
  2. Bug #75167 (DateTime::add does only care about backward DST transition, not forward)
  3. --FILE--
  4. <?php
  5. $tz = new DateTimeZone('Europe/London'); // A timezone that has DST
  6. $five_hours_interval = new DateInterval('PT5H');
  7. $date = new DateTime("2014-3-30 00:00:00", $tz);
  8. // Add five hours and subtract 5 hours. The $newDate should then equal the date.
  9. $five_hours_later = (clone $date)->add($five_hours_interval);
  10. $newDate = (clone $five_hours_later)->sub($five_hours_interval);
  11. echo $date->format('c') . "\n";
  12. echo $newDate->format('c');
  13. ?>
  14. --EXPECT--
  15. 2014-03-30T00:00:00+00:00
  16. 2014-03-30T00:00:00+00:00