xref: /PHP-8.1/ext/date/tests/bug-gh11368.phpt (revision 0747616f)
1--TEST--
2Bug GH-11368: Date modify returns invalid datetime
3--INI--
4date.timezone=UTC
5--FILE--
6<?php
7
8$datetime = date_create('2023-06-04');
9
10$datetime->setTime(1,1,1,1 /* If set to any other number, it works fine */);
11var_dump($datetime);
12
13$datetime->modify('-100 ms');
14var_dump($datetime);
15
16?>
17--EXPECTF--
18object(DateTime)#1 (3) {
19  ["date"]=>
20  string(26) "2023-06-04 01:01:01.000001"
21  ["timezone_type"]=>
22  int(3)
23  ["timezone"]=>
24  string(3) "UTC"
25}
26object(DateTime)#1 (3) {
27  ["date"]=>
28  string(26) "2023-06-04 01:01:00.900001"
29  ["timezone_type"]=>
30  int(3)
31  ["timezone"]=>
32  string(3) "UTC"
33}
34