File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ PHP NEWS
1010 different type). (Derick)
1111 . Fixed bug GH-8964 (DateTime object comparison after applying delta less
1212 than 1 second). (Derick)
13+ . Fixed bug GH-9106: (DateInterval 1.5s added to DateTimeInterface is rounded
14+ down since PHP 8.1.0). (Derick)
1315 . Fixed bug #81263 (Wrong result from DateTimeImmutable::diff). (Derick)
1416
1517- DBA:
Original file line number Diff line number Diff line change 1+ --TEST--
2+ Test for bug GH-9601: DateInterval 1.5s added to DateTimeInterface is rounded down since PHP 8.1.0
3+ --INI--
4+ date.timezone=UTC
5+ --FILE--
6+ <?php
7+
8+ $ start = new \DateTimeImmutable ("2020-01-01 00:00:00 UTC " );
9+
10+ $ oneAndHalfSec = new \DateInterval ("PT1S " );
11+ $ oneAndHalfSec ->f = 0.5 ;
12+
13+ $ t1 = $ start ->add ($ oneAndHalfSec );
14+ $ t2 = $ t1 ->add ($ oneAndHalfSec );
15+ $ t3 = $ t2 ->add ($ oneAndHalfSec );
16+ $ t4 = $ t3 ->add ($ oneAndHalfSec );
17+
18+ var_dump ($ start ->getTimestamp ());
19+ var_dump ($ t1 ->getTimestamp ());
20+ var_dump ($ t2 ->getTimestamp ());
21+ var_dump ($ t3 ->getTimestamp ());
22+ var_dump ($ t4 ->getTimestamp ());
23+ ?>
24+ --EXPECT--
25+ int(1577836800)
26+ int(1577836801)
27+ int(1577836803)
28+ int(1577836804)
29+ int(1577836806)
You can’t perform that action at this time.
0 commit comments