-
-
Notifications
You must be signed in to change notification settings - Fork 669
Closed
Description
After noticing #318, I started looking closer and this is what I found.
Issue
If, in your 'subject', you include multiple spaces between words, the 'DoesNotContainUrl' validation error will be triggered. This is because the following code successfully passes validation:
// from line 24 in DoesNotContainUrlRule.php
$validator->make(['word' => ''], ['word' => 'url'])->passes();
// returns true (which, in turn, causes false to be returned from the rule)When we explode the subject and pass each element to the above validator, any elements that are an empty string will allow the validation to pass. Therefore the custom rule will fail.
Possible solutions
EDITED
- Add 'required' to the inner loop that validates each part of the string as a url. This way, if an empty string is checked, it will pass; allowing the custom rule to fail.
- Remove the extra spaces prior to the inner validation loop.
- Add sanitization to inputs, either at the middleware or form-request level.
Metadata
Metadata
Assignees
Labels
No labels