|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-03-10 15:43 UTC] neeke@php.net
-Status: Open
+Status: Assigned
-Assigned To:
+Assigned To: neeke
[2015-04-20 07:06 UTC] christophe at gesche dot org
[2015-06-02 01:13 UTC] neeke@php.net
[2015-06-29 03:56 UTC] neeke@php.net
-Status: Assigned
+Status: Closed
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 16 15:00:02 2025 UTC |
Description: ------------ `DateTime::createFromFormat($format, $time, DateTimeZone $timezone = null)` has a default value for its third parameter `$timezone`, but it doesn't accept `null` as a value. Running the following script will raise a warning: DateTime::createFromFormat('Y/m/d', '2015/1/1', null); // Warning: DateTime::createFromFormat() expects parameter 3 to be DateTimeZone, null given While the documentation states that the default timezone is going to be used when no parameter is given, also the case where a `null` `$timezone` is given should be handled correctly. This would align the API to the language semantics about default values. Test script: --------------- <?php var_dump(get_class(DateTime::createFromFormat('Y/m/d', '2015/1/1', null))); Expected result: ---------------- string(8) "DateTime" Actual result: -------------- Warning: DateTime::createFromFormat() expects parameter 3 to be DateTimeZone, null given in %a on line 3 Warning: get_class() expects parameter 1 to be object, boolean given in %a on line 3 bool(false)