Skip to content

Bug #68669 DateTime::createFromFormat() does not allow NULL $timezone #1167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

Neeke
Copy link

@Neeke Neeke commented Mar 10, 2015

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.

@Rican7
Copy link
Contributor

Rican7 commented Mar 13, 2015

Makes sense to me.

@laruence
Copy link
Member

when I was trying to merge this patch, I found this is already be fixed in master by Sara in 365f428

@krakjoe
Copy link
Member

krakjoe commented Jan 4, 2017

Since this targets an unsupported branch of PHP, and since the issue is already fixed in a supported branch anyway, I'm closing this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants