-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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.6] Fix uniqueStrict for keyless calls to it #21854
[5.6] Fix uniqueStrict for keyless calls to it #21854
Conversation
This is a breaking change. |
Sounds more like a bug fix than a breaking change. |
@deleugpn, I agree, a very old one, which may cause some BC for those who had hacked their code to overcome it, but still a bug, because there are some others out there thinking their non-strict unique results are fine, but they aren't. The way it is, everything is treated as strict when using |
The point that the tests fail is a clear indication that it is a breaking change. There will be people expecting the same behaviour as the tests do. |
Fine. Forgot to check that. But claim can be still made that users see the existing behaviour as expected. Graham has already made it to point to master so that's settled i guess |
As a bug fix, it should go to 5.5 |
If it is a bug fix, first an issue should be made so that others can reproduce the bug 😛 |
@deleugpn That's not what that means. What that means is you may sent a PR with a broken test, and no other changes, to demonstrate a bug. |
@GrahamCampbell and what is the problem of implementing the fix in the same PR? |
There is no problem, only if the tests pass after. |
Then there you have it.
Therefore, it should go to 5.5. |
205c525
to
5a38e1b
Compare
I just split it in different PRs, one for bug report and this one only to fix it. |
What if someone is using |
It's tagged as 5.6 (which is next Laravel's "major" version, since it allows breaking changes on it), mate, so I think we got enough chat about BC, don't you? Or are you telling us to not fix this bug at all? |
I don't really care if it goes on 5.5 or 5.6, it doesn't look like a security issue, it was not even a problem for me, I only bumped into it because I was literally rewriting all tests for Collection, under the perspective of a new package I'm creating, and I could not make the one for What I think is important here: the bug was identified and at least one fix was created for it, but this PR may not be even the fix Taylor and the Core will merge to 5.6 or 5.5. |
I was replying to Deleu's comments about merging this to 5.5 |
@taylorotwell Thanks for the merge, but the tests related to this bug are in the PR you just close. |
@antonioribeiro you should have kept it in the same PR. |
Looks like
array_unique
is always strict, so if you are trying to get uniques from a keyless Collection:Those two unique calls:
Will both return
[10]
This PR fix this by using
valueRetriever
also when the user does not pass a key to uniqueStrict().