xref: /PHP-8.0/ext/date/tests/bug49585.phpt (revision 36990aab)
1--TEST--
2Bug #49585 (date_format buffer not long enough for >4 digit years)
3--FILE--
4<?php
5date_default_timezone_set('UTC');
6
7$date = new DateTime('-1500-01-01');
8var_dump($date->format('r'));
9
10$date->setDate(-2147483648, 1, 1);
11var_dump($date->format('r'));
12var_dump($date->format('c'));
13?>
14--EXPECT--
15string(32) "Fri, 01 Jan -1500 00:00:00 +0000"
16string(38) "Tue, 01 Jan -2147483648 00:00:00 +0000"
17string(32) "-2147483648-01-01T00:00:00+00:00"
18