-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[Validator] Add option to allow ANY protocol in Assert\Url constraint #21398
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -237,6 +237,21 @@ the ``ftp://`` type URLs to be valid, redefine the ``protocols`` array, listing | |
} | ||
} | ||
|
||
The value of this option can also be an asterisk (``*``) to allow all protocols | ||
or a regular expression:: | ||
|
||
// allows all protocols whose names are RFC 3986 compliant | ||
// (e.g. 'https://', 'git+ssh://', 'file://', 'custom://') | ||
protocols: ['*'] | ||
|
||
// regular expressions are also valid | ||
protocols: ['https?', 'custom.*', 'my-app-.*'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we backport this to older branches? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't follow you. Is this available in older branches? I thought it was a new feature added in 7.4. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe then this actually doesn't work at all? Because the only change I see in symfony/symfony#60561 is a strict comparison with |
||
|
||
.. versionadded:: 7.4 | ||
|
||
Support for ``*`` and regular expressions in the ``protocols`` option was | ||
introduced in Symfony 7.4. | ||
|
||
``relativeProtocol`` | ||
~~~~~~~~~~~~~~~~~~~~ | ||
|
||
|
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.
I wonder if we should allow
'*'
(so a string without the need to wrap it in an array)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.
see #21406