xref: /PHP-8.2/ext/date/tests/bug73294.phpt (revision f8d79582)
1--TEST--
2Bug #73294: DateTime wrong when date string is negative
3--FILE--
4<?php
5for ( $i = -1050; $i <= -1000; $i++ )
6{
7    $M = "06";
8    $D = "22";
9
10    $dt = new DateTime("{$i}-{$M}-{$D} 00:00:00");
11    $expected = "{$i}-{$M}-{$D} 00:00:00";
12    $result = $dt->format('Y-m-d H:i:s');
13
14    if ( $expected != $result )
15    {
16        echo "Wrong: Should have been {$expected}, was {$result}\n";
17    }
18}
19?>
20==DONE==
21--EXPECT--
22==DONE==
23