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

Add error handling when misuse of find() with array values #11285

Open
wants to merge 7 commits into
base: 3.4.x
Choose a base branch
from

Conversation

symfonyaml
Copy link

@symfonyaml symfonyaml commented Feb 21, 2024

Q A
Branch? 3.1.x
Bug fix? yes
New feature? no
Issues Fix #11236

Issue

When we (inexpertly) use $em->find(...) with array values in identifer, it returns a PHP warning..
See all details and how to reproduce it in the issue : #11236.

Solution

In this PR

  • Add some DX with an exception explaining the problem, to avoid PHP warning
  • Add tests

Notes

This PR is a copy of this PR who has been re-targeted to branch 3.1.x

src/UnitOfWork.php Outdated Show resolved Hide resolved
Copy link
Contributor

There hasn't been any activity on this pull request in the past 90 days, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days.
If you want to continue working on it, please leave a comment.

@github-actions github-actions bot added the Stale label Oct 16, 2024
@greg0ire greg0ire changed the base branch from 3.1.x to 3.4.x October 17, 2024 15:45
static function ($value) {
if ($value instanceof BackedEnum) {
return $value->value;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks redundant… isn't it already handled on line 1561?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks redundant yes, but the check is not ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get it… after line 1565, can no longer contain any BackedEnum, right? So why add this check?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok yes got it. I removed this check thank you !

@github-actions github-actions bot removed the Stale label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants