|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-06-14 10:59 UTC] cmb@php.net
-Status: Open
+Status: Not a bug
-Assigned To:
+Assigned To: cmb
[2016-06-14 10:59 UTC] cmb@php.net
[2016-06-16 19:09 UTC] marc at mabe dot berlin
[2016-06-16 22:29 UTC] cmb@php.net
-Status: Not a bug
+Status: Re-Opened
-Assigned To: cmb
+Assigned To:
[2016-06-16 22:29 UTC] cmb@php.net
[2021-01-06 18:09 UTC] cmb@php.net
-Status: Re-Opened
+Status: Duplicate
-Assigned To:
+Assigned To: cmb
[2021-01-06 18:09 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 02 07:00:01 2025 UTC |
Description: ------------ If using the DatePeriod->interval the DateInterval object has not been correctly initialized by its constructor. With this bug it is impossible to take a DatePeriod object as one argument in a function :( Test script: --------------- <?php $start = new DateTime('2015-09-01'); $end = new DateTime('2015-09-02'); $interval = new DateInterval('P1D'); $period = new DatePeriod($start, $interval, $end); foreach ($period as $current) { $currentEnd = clone $current; $currentEnd->add($period->interval); var_dump($current, $currentEnd); } Expected result: ---------------- object(DateTime)#6 (3) { ["date"]=> string(26) "2015-09-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#7 (3) { ["date"]=> string(26) "2015-09-02 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Actual result: -------------- Warning: DateTime::add(): The DateInterval object has not been correctly initialized by its constructor in /in/tmZN9 on line 10 object(DateTime)#6 (3) { ["date"]=> string(26) "2015-09-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#7 (3) { ["date"]=> string(26) "2015-09-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }