1--TEST-- 2Test for bug GH-9601: DateInterval 1.5s added to DateTimeInterface is rounded down since PHP 8.1.0 3--INI-- 4date.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 18var_dump($start->getTimestamp()); 19var_dump($t1->getTimestamp()); 20var_dump($t2->getTimestamp()); 21var_dump($t3->getTimestamp()); 22var_dump($t4->getTimestamp()); 23?> 24--EXPECT-- 25int(1577836800) 26int(1577836801) 27int(1577836803) 28int(1577836804) 29int(1577836806) 30