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] Argument 1 passed to Illuminate\Database\Query\Builder::cleanBindings() must be of the type array, null given #28251

Closed
Cannonb4ll opened this issue Apr 18, 2019 · 15 comments
Labels

Comments

@Cannonb4ll
Copy link
Contributor

Cannonb4ll commented Apr 18, 2019

  • Laravel Version: 5.8.12
  • PHP Version: 7.2.14
  • Database Driver & Version: MySQL 5.7.20

Description:

Just this morning upgraded from 5.8.11 to 5.8.12 which completely broke my application on the wherePivot part.

Broken:

$variable = $user->books()->wherePivot('owner', true)->findOrFail($id);

Fixed:

$variable = $user->books()->wherePivot('owner', '=', true)->findOrFail($id);

Has this been done intentionally? I cannot find anything regarding this change inside the core update. My code has not changed since the upgrade from 5.8.11 -> 5.8.12

@JeroenBoesten
Copy link
Contributor

It seems to me like a unintentional change, because it's not regarding every other where statement where it's just assumed that '=' is the operator if no operator is specified. Could this possibly be related to the changes made to the where here: #28192

@ankurk91
Copy link
Contributor

Lucky i am using withPivotValue() method which internally uses

$this->wherePivot($column, '=', $value)

@Cannonb4ll
Copy link
Contributor Author

@ankurk91 I fail to see how this is contributing to this core issue.

@ahinkle
Copy link
Contributor

ahinkle commented Apr 18, 2019

Hey, the original PR was reverted (04a547e) and was released in 5.8.13. This issue is now solved. An additional test has been submitted to prevent future issues. #28260

@ghost
Copy link

ghost commented Jun 28, 2019

This issue has arisen again in Laravel Version 5.8.23

@staudenmeir
Copy link
Contributor

@mjhorninger What query causes this error for you?

@ghost
Copy link

ghost commented Jun 28, 2019

So it's a nested set of models, and needs to be refactored desperately.
We can query all the way down through three layers of models, but when we try to access a convenience method on the bottom layer that retrieves a non-related model, it breaks.

@ghost
Copy link

ghost commented Jun 28, 2019

The bottom query that fails is: Pair::whereIn('id', $groupOfPairIds)->get();

@staudenmeir
Copy link
Contributor

What's the last working Laravel version?

@staudenmeir
Copy link
Contributor

What's the result of dd($groupOfPairIds);?

@ghost
Copy link

ghost commented Jun 28, 2019

dd($groupOfPairIds) gives an array -
[ 0 => 32 1 => 34, 2 => 36 3 => 38 ]

@staudenmeir
Copy link
Contributor

Did you see my other question?

What's the last working Laravel version?

@ghost
Copy link

ghost commented Jun 28, 2019

I did. Unfortunately, I got sucked into a meeting. I'm peeling back the onion based on our upgrade path and testing with 5.8.13 now

@ghost
Copy link

ghost commented Jun 28, 2019

I'm all the way back at 5.8.0 which means this piece of functionality does not get tested very often. I'm still seeing the issue.
At this point it had to be something peculiar to our stack. I have tested the call in tinker and it works all the way forward to the latest version (.26). It's not until the datatables get involved that it starts to fall apart.
Mea culpa - Sorry to send you on the wild goose chase.

@tinhtu9x

This comment has been minimized.

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

No branches or pull requests

7 participants