xref: /PHP-8.4/ext/date/tests/bug68669.phpt (revision 7aacc705)
1--TEST--
2DateTime::createFromFormat() does not allow NULL $timezone
3--FILE--
4<?php
5
6date_default_timezone_set('America/Los_Angeles');
7var_dump(DateTime::createFromFormat('Y/m/d H:i:s', '1995/06/08 12:34:56', null));
8var_dump(DateTimeImmutable::createFromFormat('Y/m/d H:i:s', '1995/06/08 12:34:56', null));
9?>
10--EXPECT--
11object(DateTime)#1 (3) {
12  ["date"]=>
13  string(26) "1995-06-08 12:34:56.000000"
14  ["timezone_type"]=>
15  int(3)
16  ["timezone"]=>
17  string(19) "America/Los_Angeles"
18}
19object(DateTimeImmutable)#1 (3) {
20  ["date"]=>
21  string(26) "1995-06-08 12:34:56.000000"
22  ["timezone_type"]=>
23  int(3)
24  ["timezone"]=>
25  string(19) "America/Los_Angeles"
26}
27