xref: /PHP-8.0/ext/date/tests/bug52480.phpt (revision 9437dcd6)
1--TEST--
2Bug #52480 (Incorrect difference using DateInterval)
3--XFAIL--
4See 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
15foreach (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===
27