xref: /PHP-8.2/ext/date/tests/bug80483.phpt (revision 1d0e5edd)
1--TEST--
2Bug #80483 (DateTime Object with 5-digit year can't unserialized)
3--INI--
4date.timezone=UTC
5--FILE--
6<?php
7
8$the_date = new DateTime();
9$the_date->SetTime(0, 0, 0);
10$the_date->SetDate(20201, 01, 01);
11
12var_dump($the_date);
13
14$serialized = serialize($the_date);
15var_dump($serialized);
16var_dump(unserialize($serialized));
17?>
18--EXPECTF--
19object(DateTime)#%d (%d) {
20  ["date"]=>
21  string(28) "+20201-01-01 00:00:00.000000"
22  ["timezone_type"]=>
23  int(3)
24  ["timezone"]=>
25  string(3) "UTC"
26}
27string(116) "O:8:"DateTime":3:{s:4:"date";s:28:"+20201-01-01 00:00:00.000000";s:13:"timezone_type";i:3;s:8:"timezone";s:3:"UTC";}"
28object(DateTime)#%d (%d) {
29  ["date"]=>
30  string(28) "+20201-01-01 00:00:00.000000"
31  ["timezone_type"]=>
32  int(3)
33  ["timezone"]=>
34  string(3) "UTC"
35}
36