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.4] Unencodable casted data in models is silently discarded #17804

Merged
merged 4 commits into from
Feb 10, 2017

Conversation

taisph
Copy link
Contributor

@taisph taisph commented Feb 7, 2017

I just discovered the hard way that data in a casting attribute that fails to be json encoded, such as iso-8859-1 encoded text, will silently be discarded when saving the model.

This PR will check the result of the encoding and throw a JsonEncodingException with a descriptive error message if encoding fails.

@GrahamCampbell GrahamCampbell changed the title Unencodable casted data in models is silently discarded [5.4] Unencodable casted data in models is silently discarded Feb 7, 2017
* @param mixed $key
* @param string $message
* @return static
* @internal param mixed $key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure @internal is necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lucasmichot Agreed. It slipped by me as I was renaming the parameter. I'll correct in a second.

@taylorotwell taylorotwell merged commit 25af453 into laravel:5.4 Feb 10, 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.

3 participants