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 3 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.4.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
src/UnitOfWork.php Outdated Show resolved Hide resolved
@github-actions github-actions bot removed the Stale label Oct 18, 2024
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.

src/UnitOfWork.php Outdated Show resolved Hide resolved
@greg0ire
Copy link
Member

Please kindly squash your commits together. If you don't, we'll try to remember to do it for you but it's best if you save us this trouble.

How to do that?

  1. git rebase -i origin/3.4.x, assuming origin is a git remote that points to this repository, and not your fork. If you're not sure what your remotes are, run git remote -vvv, there should be your fork and the holy/reference/base/origin/whatever-you-call-it repository.
  2. A window will show up with many lines, replace pick with fixup on every line but the first one
  3. Close your editor, git should do its magic, and you should end up with one commit
  4. Use git push --force to overwrite what you already pushed. Don't forget the --force option otherwise git will try to merge both things together.

@symfonyaml symfonyaml force-pushed the fix-error-handling-find branch from 9fe5225 to e4d6329 Compare January 24, 2025 11:54
@symfonyaml
Copy link
Author

@greg0ire I rebased the PR as you suggested. But now I have this BackedEnum check coming from 3.4.x.

    foreach ($identifier as $k => $value) {
        if ($value instanceof BackedEnum) {
            $identifier[$k] = $value->value;
        }
    }

I thought you said it was redundant so I am confused...

@greg0ire
Copy link
Member

In the interactive rebase window, you can drop any commit you feel is unnecessary… I don't know how you managed to make them appear.

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