Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions reference/constraints/Url.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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: ['*']
Copy link
Member

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)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see #21406


// regular expressions are also valid
protocols: ['https?', 'custom.*', 'my-app-.*']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we backport this to older branches?

Copy link
Member Author

Choose a reason for hiding this comment

The 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.

Copy link
Member

@xabbuh xabbuh Sep 24, 2025

Choose a reason for hiding this comment

The 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 ['*']. The remaining behaviour of the validator didn't change.


.. versionadded:: 7.4

Support for ``*`` and regular expressions in the ``protocols`` option was
introduced in Symfony 7.4.

``relativeProtocol``
~~~~~~~~~~~~~~~~~~~~

Expand Down