xref: /PHP-7.1/ext/date/tests/bug68669.phpt (revision 365f428d)
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--EXPECT--
10object(DateTime)#1 (3) {
11  ["date"]=>
12  string(26) "1995-06-08 12:34:56.000000"
13  ["timezone_type"]=>
14  int(3)
15  ["timezone"]=>
16  string(19) "America/Los_Angeles"
17}
18object(DateTimeImmutable)#1 (3) {
19  ["date"]=>
20  string(26) "1995-06-08 12:34:56.000000"
21  ["timezone_type"]=>
22  int(3)
23  ["timezone"]=>
24  string(19) "America/Los_Angeles"
25}
26