Skip to content

Commit ff25fb4

Browse files
committed
minor #21398 [Validator] Add option to allow ANY protocol in Assert\Url constraint (javiereguiluz)
This PR was squashed before being merged into the 7.4 branch. Discussion ---------- [Validator] Add option to allow ANY protocol in Assert\Url constraint Fixes #21397. Commits ------- 49cb38b [Validator] Add option to allow ANY protocol in Assert\Url constraint
2 parents ef045c6 + 49cb38b commit ff25fb4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

reference/constraints/Url.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,21 @@ the ``ftp://`` type URLs to be valid, redefine the ``protocols`` array, listing
237237
}
238238
}
239239
240+
The value of this option can also be an asterisk (``*``) to allow all protocols
241+
or a regular expression::
242+
243+
// allows all protocols whose names are RFC 3986 compliant
244+
// (e.g. 'https://', 'git+ssh://', 'file://', 'custom://')
245+
protocols: ['*']
246+
247+
// regular expressions are also valid
248+
protocols: ['https?', 'custom.*', 'my-app-.*']
249+
250+
.. versionadded:: 7.4
251+
252+
Support for ``*`` and regular expressions in the ``protocols`` option was
253+
introduced in Symfony 7.4.
254+
240255
``relativeProtocol``
241256
~~~~~~~~~~~~~~~~~~~~
242257

0 commit comments

Comments
 (0)