-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpKernel] Conversion of type in #[MapQueryString] constructor is no longer accepted since Symfony 7.1.10 #59353
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
Comments
we came across the same problem at Pimcore |
I installed a fresh Symfony 7.1.10 locally and required My
The reason why you get a type mismatch here is because eventually, the code execution ends up in the
You can check the order by running
Since you are using the If we remove the annotation then we get the following behavior:
Depending on your context, the solutions are the following:
|
Thanks for detailed explanation!
Well issue I see is that for successful denormalization, |
Indeed. The Maybe @Korbeil can shed some light here. |
We're seeing the same issue in 6.4. Our workaround for now has been to rename the class property so it doesn't have the same name as the constructor argument, e.g.: readonly class ScimQueryInput
{
/** @var list<string> */
private array $attributesArray;
public function __construct(string $attributes = '') {
$this->attributesArray = $attributes ? explode(',', $attributes) : [];
} |
Symfony version(s) affected
7.1.10
Description
Since #59134, DTO that changes type in a constructor is no longer accepted.
Trigger of this seem to be that in a given PR,
disable_type_enforcement
no longer defaults to true. However, this might be a deeper issue, as thanks to type juggling in constructor there should not be any type mismatch in the first place. Notice that in reproducer, although (private) property is declared to be an array, constructor accepts string. Hence, denormalization should accept string.I bet this is another issue of a kind in #46918, since serializer has no way to distinguish class property named same way as constructor parameter
How to reproduce
Query DTO:
Controller:
Call:
/api/datasync/scim/Users?attributes=displayName,userName
Response:
Possible Solution
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: