-
-
Notifications
You must be signed in to change notification settings - Fork 669
Allow multiple spaces between words in subject #322
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
Allow multiple spaces between words in subject #322
Conversation
driesvints
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for sending this in! Just two small changes needed and I'll merge this.
tests/Feature/ForumTest.php
Outdated
| ->see('Foo Tag') | ||
| ->see('Thread successfully created!'); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove this test again. The bug is covered with the smaller test for the validation rule above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
| { | ||
| const STRING_WITH_URL = 'This is a string http://example.com with an url in it.'; | ||
| const STRING_WITHOUT_URL = 'This is a string without an url in it.'; | ||
| const STRING_WITH_A_REGRESSION = 'JSON not possible with MSSQL running on Windows platform?'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove this constant again? I forgot to remove it in a previous commit :')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
|
I'll take care of the requested changes shortly. Thanks! |
|
Thanks! Will come online in a bit. |
Addresses #321
Also, if you look closely at #318, the failure was due to two whitespaces after "JSON".
Current
Currently, the way the subject is checked DoesNotContainUrlRule is that the subject is "exploded" into an array, then each element is checked via:
if the loop completes, with each element failing the 'url' check, then the custom rule passes.
Problem
The problem is that if there is more than one space between words in the subject, some elements of the exploded subject will just be an empty string, which in this case passes
['word' => 'url']validation. This in turn makes the custom rule fail.Goal
Honestly, I think you should consider adding some sanitization to your inputs, then we could avoid this fix. So if you don't want to pull this in, and address it closer to the beginning of the request, that's great as well.