[6.x] Fix a regression caused by #32315 #32388
Merged
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 fixes a regression caused by #32315, in which the regular expression was updated based on Symfony's Validator, but in doing so percent signs were copied across incorrectly. As a result, some valid URLs are now being reported as invalid. An example URL would be
https://domain.com/path/%2528failed%2526?param=1#fragment
; admittedly, this is wrongly encoded, but that is kind of the point, as it is not technically invalid. I've added this URL to the test too.Symfony runs their regular expression through
sprintf()
, so the double-encoded percent signs (%%
) come out of that as single ones (%
).This PR rectifies that. I generated the updated regular expression by running the whole thing through
sprintf()
like Symfony would've, but with Laravel's fixed set of protocols.I've set the target to 6.x as this is a clear bug fix that should go into 6.x and 7.x alike.