Skip to content

[Routing] Add test to validate that default value is allowed to not match requirement #61094

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

Merged
merged 1 commit into from
Jul 15, 2025

Conversation

tcoch
Copy link
Contributor

@tcoch tcoch commented Jul 10, 2025

Q A
Branch? 6.4
Bug fix? no
New feature? no
Deprecations? no
Issues #61022
License MIT

Suppose you have this route definition:

$route = new Route('/test/{foo}', ['foo' => 'foo-'], ['foo' => '\w+'], []);

With this route definition:

  • /test/foo works
  • /test/foo- fails, because the dash is not permitted by the requirement
  • /test works, thanks to the default value. However, the value of the parameter foo does not meet the requirement.

@nicolas-grekas
Copy link
Member

Thank you @tcoch.

@nicolas-grekas nicolas-grekas merged commit e5d6c57 into symfony:6.4 Jul 15, 2025
1 check was pending
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Jul 15, 2025
This PR was squashed before being merged into the 6.4 branch.

Discussion
----------

Add tip about default value

Related to symfony/symfony#61094

Commits
-------

5fd4e23 Add tip about default value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants