bug74639.phpt 633 B

1234567891011121314151617181920212223242526272829
  1. --TEST--
  2. Bug #74639 Cloning DatePeriod leads to segfault
  3. --FILE--
  4. <?php
  5. $start = new DateTime('2017-05-22 09:00:00');
  6. $end = new DateTime('2017-08-24 18:00:00');
  7. $interval = $start->diff($end);
  8. $period = new DatePeriod($start, $interval, $end);
  9. $clonedPeriod = clone $period;
  10. $clonedInterval = clone $interval;
  11. if ($period->getStartDate() != $clonedPeriod->getStartDate()) {
  12. echo "failure\n";
  13. }
  14. if ($period->getEndDate() != $clonedPeriod->getEndDate()) {
  15. echo "failure\n";
  16. }
  17. if ($interval->format('Y-m-d H:i:s') != $clonedInterval->format('Y-m-d H:i:s')) {
  18. echo "failure\n";
  19. }
  20. echo 'success';
  21. ?>
  22. --EXPECT--
  23. success