fix: handling of empty array in SQL condition generation#12254
fix: handling of empty array in SQL condition generation#12254greg0ire merged 5 commits intodoctrine:2.20.xfrom
Conversation
There was a problem hiding this comment.
There should probably be a functional test for this. That way we'll be sure it works with all database platforms.
c042729 to
5d285c8
Compare
5d285c8 to
53fd92b
Compare
53fd92b to
aba173a
Compare
aba173a to
23f2286
Compare
|
@mpdude please review |
|
Unfortunately, provided solution doesn't work in our use case, same error: |
Can you give me more details, like which database system you’re using and when this happened? |
|
I can confirm that it works here with MySQL, ORM v3.5.3. |
| $value = [$value]; | ||
| } | ||
|
|
||
| if (empty($value)) { |
There was a problem hiding this comment.
Might compare array with === [] here.
|
It could be unrelated, I think it's working for you, because it's simple case, but Ramsey has |
|
Sorry for confusion, I retract all my comments, it looks like we had bugfix, which doesn't work anymore. But thanks for fixing things! ❤️ |
|
@elliotbruneel Thank you for working on this! Two remarks, probably a matter of personal preference:
If you're looking for a suggestion, you may want to check https://github.com/doctrine/orm/compare/2.20.x...mpdude:doctrine2:fix-12190-regression?expand=1. |
|
Just noticed that |
My first goal was indeed to keep original generated code. I have edited the logic as it's more clear |
| @@ -1056,6 +1056,12 @@ parameters: | |||
| count: 1 | |||
| path: src/Internal/HydrationCompleteHandler.php | |||
|
|
|||
There was a problem hiding this comment.
Where's that coming from? Maybe you need to rebase to make it go away?
There was a problem hiding this comment.
It's come from the update of phpstan to 2.1.23
|
@mpdude as long as it is in a separate commit, which is the case, I'm satisfied. |
|
Thanks @elliotbruneel ! |
|
@mpdude |
|
Not |
|
postgresql: # SELECT * FROM unnest(ARRAY[true, false]) AS t(col) WHERE col IN (1=0);
col
-----
f
(1 row)
# SELECT * FROM unnest(ARRAY[null, true, false]) AS t(col) WHERE col IN (null);
col
-----
(0 rows)
@mpdude oh I see now, the suggestion was not to have |
- removed no longer needed conflict introduced in #4252 - see doctrine/orm#12254
- removed no longer needed conflict introduced in shopsys/shopsys#4252 - see doctrine/orm#12254
- removed no longer needed conflict introduced in shopsys/shopsys#4252 - see doctrine/orm#12254
- removed no longer needed conflict introduced in shopsys/shopsys#4252 - see doctrine/orm#12254
- removed no longer needed conflict introduced in shopsys/shopsys#4252 - see doctrine/orm#12254
- removed no longer needed conflict introduced in shopsys/shopsys#4252 - see doctrine/orm#12254
- removed no longer needed conflict introduced in shopsys/shopsys#4252 - see doctrine/orm#12254
- removed no longer needed conflict introduced in shopsys/shopsys#4252 - see doctrine/orm#12254
- removed no longer needed conflict introduced in shopsys/shopsys#4252 - see doctrine/orm#12254
- removed no longer needed conflict introduced in shopsys/shopsys#4252 - see doctrine/orm#12254
- removed no longer needed conflict introduced in shopsys/shopsys#4252 - see doctrine/orm#12254
- removed no longer needed conflict introduced in shopsys/shopsys#4252 - see doctrine/orm#12254
- removed no longer needed conflict introduced in shopsys/shopsys#4252 - see doctrine/orm#12254
- removed no longer needed conflict introduced in shopsys/shopsys#4252 - see doctrine/orm#12254


Fix a regression introduced in #12190:
$repository->findBy(['uuid' => []]should be a valid expression and return an empty result.Fixes #12245, with additional discussion at #12190 (comment).