php-src/ext/date/tests/bug68669.phpt
Sara Golemon 365f428d46 Allow the third arg to DateTime(Immutable)::createFromFormat() to be null.
Permit the same meaning as not passing the arg at all.
2014-12-30 13:58:59 -08:00

26 lines
657 B
PHP

--TEST--
DateTime::createFromFormat() does not allow NULL $timezone
--FILE--
<?php
date_default_timezone_set('America/Los_Angeles');
var_dump(DateTime::createFromFormat('Y/m/d H:i:s', '1995/06/08 12:34:56', null));
var_dump(DateTimeImmutable::createFromFormat('Y/m/d H:i:s', '1995/06/08 12:34:56', null));
--EXPECT--
object(DateTime)#1 (3) {
["date"]=>
string(26) "1995-06-08 12:34:56.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(19) "America/Los_Angeles"
}
object(DateTimeImmutable)#1 (3) {
["date"]=>
string(26) "1995-06-08 12:34:56.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(19) "America/Los_Angeles"
}