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.4] Add type check before validating URL #17504

Merged
merged 1 commit into from
Jan 24, 2017

Conversation

mathielo
Copy link
Contributor

Fix when passing a non-string value to the URL validator would break the application:

ErrorException

/var/www/application/vendor/illuminate/validation/Validator.php (1596)
preg_match() expects parameter 2 to be string, object given

Added the very same check that is done at validateActiveUrl() before trying to preg_match the URL pattern.

This bug was discovered when a frontend application was sending (by mistake) wrong data to the backend API. The frontend bug was fixed; However the application should not break when trying to validate input data.

@mathielo mathielo changed the title Add type check before validating URL [5.4] Add type check before validating URL Jan 24, 2017
@taylorotwell taylorotwell merged commit 052e9a5 into laravel:5.4 Jan 24, 2017
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