Skip to content

Update Builder.php#20553

Merged
taylorotwell merged 1 commit into
laravel:5.4from
yosef-boaelite:5.4
Aug 14, 2017
Merged

Update Builder.php#20553
taylorotwell merged 1 commit into
laravel:5.4from
yosef-boaelite:5.4

Conversation

@yosef-boaelite

Copy link
Copy Markdown
Contributor

Fixed $boolean parameter being ignored by "where" function, when the $column parameter is an array.

In detail: the following code should produce a query with "or" conditions:

..->where(["col1"=>"val1","col2"=>"val2"],null,null,"or");

But, it produced the query with "and" conditions - ignoring the last parameter "or" and taking it as "and" (default value)

@taylorotwell taylorotwell merged commit 87a29a2 into laravel:5.4 Aug 14, 2017
@jarnovanleeuwen

jarnovanleeuwen commented Aug 23, 2017

Copy link
Copy Markdown
Contributor

FYI: This change caused very strange behaviour in our application as some part of a query flipped from a = a or (b = b and c = c) to a = a or (b = b or c = c). Even though this probably was a programming bug on our side, I can imagine this PR can introduce a hard-to-spot bug in many applications and perhaps a test was missing?

@yosef-boaelite

yosef-boaelite commented Aug 23, 2017 via email

Copy link
Copy Markdown
Contributor Author

@jarnovanleeuwen

Copy link
Copy Markdown
Contributor

Yeah, your PR is probably correct, but applications that relied on the previous orWhere behaviour might break.

Example:

$query->where(['a' => 'a'])->orWhere(['b' => 'b', 'c' => 'c'])

@yosef-boaelite

yosef-boaelite commented Aug 23, 2017 via email

Copy link
Copy Markdown
Contributor Author

@jarnovanleeuwen

jarnovanleeuwen commented Aug 23, 2017 via email

Copy link
Copy Markdown
Contributor

@yosef-boaelite

yosef-boaelite commented Aug 24, 2017 via email

Copy link
Copy Markdown
Contributor Author

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