1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Files
archived-php-src/ext/date/tests/bug-gh11368.phpt
2023-06-22 17:58:19 +01:00

34 lines
604 B
PHP

--TEST--
Bug GH-11368: Date modify returns invalid datetime
--INI--
date.timezone=UTC
--FILE--
<?php
$datetime = date_create('2023-06-04');
$datetime->setTime(1,1,1,1 /* If set to any other number, it works fine */);
var_dump($datetime);
$datetime->modify('-100 ms');
var_dump($datetime);
?>
--EXPECTF--
object(DateTime)#1 (3) {
["date"]=>
string(26) "2023-06-04 01:01:01.000001"
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}
object(DateTime)#1 (3) {
["date"]=>
string(26) "2023-06-04 01:01:00.900001"
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}