[9.x] Validate uuid before route binding query - #44945
Merged
taylorotwell merged 8 commits intoNov 21, 2022
Merged
Conversation
Member
|
We might want to do the same for the ULID trait? |
Contributor
I created it |
Member
|
I don't think this properly addresses child route bindings. |
taylorotwell
marked this pull request as draft
November 17, 2022 21:03
Member
Author
|
It looks like moving the check down to resolveRouteBindingQuery catches the child bindings as well. I updated the pull request. Let me know if you'd like to see any other changes. |
benbjurstrom
marked this pull request as ready for review
November 17, 2022 22:06
Member
|
Don't you actually need to check and use the |
Member
Author
|
I'm sure you're right. I'll take another look at it. Thanks! |
benbjurstrom
marked this pull request as draft
November 17, 2022 22:37
|
|
||
| $this->beforeApplicationDestroyed(function () { | ||
| Schema::dropIfExists('users'); | ||
| Schema::dropIfExists('posts'); |
Contributor
There was a problem hiding this comment.
Please add the drop method of the table comments in beforeApplicationDestroyed
benbjurstrom
marked this pull request as ready for review
November 18, 2022 20:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request overrides the resolveRouteBinding method in the HasUuids trait to ensure the given URI segment is a valid UUID before passing it to the database.
This check is necessary when using a Postgres database with the UUID datatype as passing anything other then a valid UUID will throw a QueryException. This check is also useful more generally to avoid unnecessary database queries.