mirror of
https://github.com/php/php-src.git
synced 2024-12-04 23:34:25 +08:00
365f428d46
Permit the same meaning as not passing the arg at all.
26 lines
657 B
PHP
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"
|
|
}
|