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

[8.x] Encode objects when casting as JSON #37759

Merged
merged 1 commit into from
Jun 21, 2021
Merged

[8.x] Encode objects when casting as JSON #37759

merged 1 commit into from
Jun 21, 2021

Conversation

halloei
Copy link
Contributor

@halloei halloei commented Jun 21, 2021

Currently one's not able to use objects with castAsJson():

ErrorException: PDO::quote() expects parameter 1 to be string, object given

The following code can be used to reproduce the bug:

    $this->assertDatabaseHas('table', [
        'column' => $this->castAsJson((object)[
            'foo' => 'bar',
        ]),
    ]);

@taylorotwell taylorotwell merged commit ad15cf5 into laravel:8.x Jun 21, 2021
@GrahamCampbell GrahamCampbell changed the title Encode objects when casting as JSON [8.x] Encode objects when casting as JSON Jun 22, 2021
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