-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
Request validation with an ::exists() rule passes validation with wrong value #54183
Comments
Is the input value parsed as int somewhere? Because numeric strings with leading digits ignore the following alphabetic characters: https://www.php.net/manual/en/language.types.numeric-strings.php#language.types.numeric-string.conversion |
Hey there, thanks for reporting this issue. We'll need more info and/or code to debug this further. Can you please create a repository with the command below, commit the code that reproduces the issue as one separate commit on the main/master branch and share the repository here? Please make sure that you have the latest version of the Laravel installer in order to run this command. Please also make sure you have both Git & the GitHub CLI tool properly set up.
Do not amend and create a separate commit with your custom changes. After you've posted the repository, we'll try to reproduce the issue. Thanks! |
This is not a laravel issue, but a database issue. Try running You will find that it returns a row with id=1 and a warning is generated Similarly, running The issue is automatic type conversion during comparison by the server (Mysql Documentation). Here is two relevant snippets from the documentation:
|
Thanks @adwiv |
Laravel Version
11.23
PHP Version
8.2.26
Database Driver & Version
MySQL 8.0.31 on MacOS arm
Description
Request validation with an ::exists() rule passes validation with a value that does not exist in the table.
Let's assume the table
users
has aforeign_id
field it is possible to have the below validation rules and send a request containing '123aabbcc' in the foreign_id value and the validation will pass as long as foreign_table has a row with an id of 123.Steps To Reproduce
The text was updated successfully, but these errors were encountered: