-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Open
Description
Symfony version(s) affected
From 7.3
Description
Context:
To ensure consistency on the frontend, our route parameters are in snake_case. We test all our routes on the backend using the generated routes, where aliases do not appear.
Until Symfony version 7.2, we used the alias feature to retrieve these parameters into camelCase variables on the backend.
Breaking Change:
After upgrading to Symfony 7.3, most routes that contain the same type of parameter twice (such as type or id), for which we used aliases, no longer work correctly.
If is normaly, I wonder if therefore the alias name is good because in our case it’s a more complex mapping than a simple alias unlike the old behavior.
How to reproduce
With Symfony 7.2
#[Route(
path: '/any/{human_type:humanType}/{role_type:roleType}',
methods: 'GET',
)]
public function __invoke(string $humanType, string $roleType): Response {
var_dump($humanType); // string(5) "panda"
var_dump($roleType); // string(4) "tank"
}With Symfony 7.3
#[Route(
path: '/any/{human_type:humanType}/{role_type:roleType}',
methods: 'GET',
)]
public function __invoke(string $humanType, string $roleType): Response {
// error
// Argument #1 ($humanType) must be of type string, array given, called ...
// Argument #2 ($roleType) must be of type string, array given, called ...
}to understand what is a new value,
#[Route(
path: '/any/{human_type:humanType}/{role_type:roleType}',
methods: 'GET',
)]
public function __invoke(mixed $humanType, mixed $roleType): Response {
var_dump($humanType); // array(1) { ["human_type"]=> string(5) "panda" }
var_dump($roleType); // array(1) { ["role_type"]=> string(4) "tank" }
}Possible Solution
No response
Additional Context
No response