Skip to content
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

[5.5] fix updating nullable dates #19672

Merged
merged 1 commit into from
Jun 19, 2017
Merged

[5.5] fix updating nullable dates #19672

merged 1 commit into from
Jun 19, 2017

Conversation

themsaid
Copy link
Member

Currently if a nullable timestamp field had a value of null, when you update it ELoquent will attempt to cast the original value to Carbon instance, and since the value is null it's going to error.

Here's where we compare original and current value to build the dirty array:

https://github.com/laravel/framework/blob/master/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php#L1007-L1009

This change will check if the given value is null and just return it as is without attempting to cast it as a carbon instance.

@taylorotwell taylorotwell merged commit 737bd83 into laravel:master Jun 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants