Skip to content

[5.8] Fix unique validation without ignored column - #27987

Merged
taylorotwell merged 1 commit into
laravel:5.8from
staudenmeir:unique
Mar 24, 2019
Merged

[5.8] Fix unique validation without ignored column#27987
taylorotwell merged 1 commit into
laravel:5.8from
staudenmeir:unique

Conversation

@staudenmeir

Copy link
Copy Markdown
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