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

[5.8] Fix unique validation without ignored column #27987

Merged
merged 1 commit into from
Mar 24, 2019
Merged

[5.8] Fix unique validation without ignored column #27987

merged 1 commit into from
Mar 24, 2019

Conversation

staudenmeir
Copy link
Contributor

#27940 broke unique validation without an ignored column:

$v = Validator::make(['email' => 'test@example.com'], ['email' => Rule::unique('users')]);
$v->passes();

// expected
select count(*) as aggregate from "users" where "email" = 'test@example.com'

// actual
select count(*) as aggregate from "users" where "email" = 'test@example.com' and "id" <> ''

We can only apply stripslashes() to non-null values.

The tests didn't catch this because Mockery only uses loose comparison.

Fixes #27986.

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.

2 participants