xref: /PHP-8.2/ext/date/tests/bug46268.phpt (revision 7aacc705)
1--TEST--
2Bug #46268 (When call DateTime#setTime, it seems to be called the last modify method too)
3--FILE--
4<?php
5date_default_timezone_set('Asia/Tokyo');
6
7$now = new DateTime('2008-10-10 01:02:03');
8echo $now->format("Y-m-d H:i:s") . PHP_EOL;
9
10$now->modify("1 day");
11echo $now->format("Y-m-d H:i:s") . PHP_EOL;
12
13$now->modify("1 hour");
14echo $now->format("Y-m-d H:i:s") . PHP_EOL;
15
16$now->setTime(0, 0, 0);
17//date_time_set($now, 0, 0, 0);
18echo $now->format("Y-m-d H:i:s") . PHP_EOL;
19?>
20--EXPECT--
212008-10-10 01:02:03
222008-10-11 01:02:03
232008-10-11 02:02:03
242008-10-11 00:00:00
25