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.6] Fix typo of missing underscore in not_regexp rule's name #24297

Merged
merged 2 commits into from
May 24, 2018
Merged

[5.6] Fix typo of missing underscore in not_regexp rule's name #24297

merged 2 commits into from
May 24, 2018

Conversation

KisGabo
Copy link
Contributor

@KisGabo KisGabo commented May 23, 2018

Without this fix, properly using "not_regex" rule name in rule arrays will result in error, if using comma in the regexp without quotes, eg.

'field' => 'string|not_regex:/.*, .*/'

The error is: preg_match(): No ending delimiter '/' found
Illuminate/Validation/Concerns/ValidatesAttributes.php:1233

However, these rules work:
'field' => 'string|regex:/.*, .*/'
'field' => 'string|not_regex:"/.*, .*/"'

It's because function parseParameters will try to split the parameter list using str_getcsv() instead of properly returning the whole $parameter.

Since "regex" rule works without quoting the regular expression, but "not_regex" rule doesn't, this behavior is confusing and inconsistent.

@KisGabo KisGabo changed the title Fix typo of missing underscore in not_regexp rule [5.6] Fix typo of missing underscore in not_regexp rule May 23, 2018
@KisGabo KisGabo changed the title [5.6] Fix typo of missing underscore in not_regexp rule [5.6] Fix typo of missing underscore in not_regexp rule's name May 23, 2018
@taylorotwell taylorotwell merged commit de7455a into laravel:5.6 May 24, 2018
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.

None yet

2 participants