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.8] Unquote JSON values on MySQL #25732

Merged
merged 1 commit into from
Sep 21, 2018
Merged

[5.8] Unquote JSON values on MySQL #25732

merged 1 commit into from
Sep 21, 2018

Conversation

staudenmeir
Copy link
Contributor

Among the four supported databases, only the MySQL implementation returns quoted JSON values:

DB::table('users')->value('options->language');

// MySQL/MariaDB:   "en"
// Other databases: en

#24817 added the ->> operator that returns unquoted values. But this doesn't change the default behavior and is incompatible with the other databases (#25726): If your application expects unquoted values on MySQL and PostgreSQL, you have to detect the database and then use 'options->>language' or 'options->language'.

I think the MySQL implementation should be consistent with the other databases and return unquoted values by default. I would argue that an unquoted value is the result a user expects.

As a breaking change, this targets 5.8.

@taylorotwell taylorotwell merged commit 24c8197 into laravel:master Sep 21, 2018
@staudenmeir staudenmeir deleted the json-mysql branch September 21, 2018 16:47
@X-Coder264
Copy link
Contributor

@staudenmeir Could you please document this breaking change in the upgrade docs for 5.8?

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