File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #52480 (Incorrect difference using DateInterval)
3
+ --XFAIL--
4
+ See https://bugs.php.net/bug.php?id=52480
5
+ --FILE--
6
+ <?php
7
+
8
+ $ expectedDiff = (array ) new DateInterval ('P30D ' );
9
+
10
+ // If the DateInterval object was created by DateTime::diff(), then this is the total
11
+ // number of days between the start and end dates. Otherwise, days will be FALSE.
12
+ // https://secure.php.net/manual/en/class.dateinterval.php
13
+ $ expectedDiff ['days ' ] = 30 ;
14
+
15
+ foreach (DateTimeZone::listIdentifiers () as $ timezone ) {
16
+ $ start = new DateTime ('2017-03-01 ' , new DateTimeZone ($ timezone ));
17
+ $ end = new DateTime ('2017-03-31 ' , new DateTimeZone ($ timezone ));
18
+
19
+ if ($ expectedDiff != (array ) $ start ->diff ($ end )) {
20
+ echo "\nWrong result for $ timezone! \n" ;
21
+ }
22
+ }
23
+ ?>
24
+ ===DONE===
25
+ --EXPECT--
26
+ ===DONE===
You can’t perform that action at this time.
0 commit comments