xref: /PHP-8.2/ext/date/tests/bug41599.phpt (revision 2d255295)
1--TEST--
2Bug #41599 (setTime() fails after modify() is used)
3--FILE--
4<?php
5date_default_timezone_set('Europe/London');
6
7$start = new DateTime('2008-01-17 last Monday');
8echo $start->format('Y-m-d H:i:s'),PHP_EOL;
9//good
10
11$start->modify('Tuesday');
12echo $start->format('Y-m-d H:i:s'),PHP_EOL;
13//good
14
15$start->setTime(4, 0, 0);
16echo $start->format('Y-m-d H:i:s'),PHP_EOL;
17//jumped to next Sunday
18
19$start->setTime(8, 0, 0);
20echo $start->format('Y-m-d H:i:s'),PHP_EOL;
21//jumped to next Sunday again
22?>
23--EXPECT--
242008-01-14 00:00:00
252008-01-15 00:00:00
262008-01-15 04:00:00
272008-01-15 08:00:00
28