Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Serializer] Fix NameConverter not detecting wrong input format with allow_extra_attributes=false#63052

Merged
nicolas-grekas merged 1 commit into
symfony:6.4from
xersion22:fix/serializer-name-converter-extra-attributes
Jan 19, 2026
Merged

[Serializer] Fix NameConverter not detecting wrong input format with allow_extra_attributes=false#63052
nicolas-grekas merged 1 commit into
symfony:6.4from
xersion22:fix/serializer-name-converter-extra-attributes

Conversation

@xersion22
Copy link
Copy Markdown
Contributor

@xersion22 xersion22 commented Jan 12, 2026

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #62725
License MIT

When using a NameConverter with allow_extra_attributes=false, wrongly formatted input (e.g., someCamelCaseProperty instead of some_camel_case_property) was silently accepted because the unconverted attribute name happened to match the property name.

This fix detects when the NameConverter didn't transform the input and checks if the property requires a different serialized format. If so, it flags the input as an extra attribute and throws ExtraAttributesException.

@xersion22 xersion22 requested a review from dunglas as a code owner January 12, 2026 07:47
@carsonbot carsonbot added this to the 8.1 milestone Jan 12, 2026
@nicolas-grekas nicolas-grekas modified the milestones: 8.1, 6.4 Jan 12, 2026
@nicolas-grekas nicolas-grekas changed the base branch from 8.1 to 6.4 January 12, 2026 08:24
@nicolas-grekas nicolas-grekas force-pushed the fix/serializer-name-converter-extra-attributes branch from 2e56af3 to ddf7926 Compare January 12, 2026 08:24
@nicolas-grekas nicolas-grekas force-pushed the fix/serializer-name-converter-extra-attributes branch from ddf7926 to 55b5388 Compare January 12, 2026 08:33
Copy link
Copy Markdown
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

👍 I rebased the PR to target 6.4 and made some minor cleanups.

@xersion22 xersion22 force-pushed the fix/serializer-name-converter-extra-attributes branch 6 times, most recently from 05463f3 to 43b9b18 Compare January 12, 2026 08:49
@nicolas-grekas
Copy link
Copy Markdown
Member

Nah sorry please revert back to the previous commit I pushed.

@nicolas-grekas nicolas-grekas force-pushed the fix/serializer-name-converter-extra-attributes branch from 43b9b18 to 55b5388 Compare January 12, 2026 09:03
@nicolas-grekas
Copy link
Copy Markdown
Member

revert back to the previous commit I pushed.

I just did it. The fabbot failure should be ignored.

@xersion22
Copy link
Copy Markdown
Contributor Author

revert back to the previous commit I pushed.

I just did it. The fabbot failure should be ignored.

Thanks

@OskarStark OskarStark changed the title [Serializer] Fix NameConverter not detecting wrong input format with allow_extra_attributes=false [Serializer] Fix NameConverter not detecting wrong input format with allow_extra_attributes=false Jan 12, 2026
@nicolas-grekas
Copy link
Copy Markdown
Member

Thank you @xersion22.

@nicolas-grekas nicolas-grekas merged commit 9e00306 into symfony:6.4 Jan 19, 2026
19 of 24 checks passed
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.

[Serializer] NameConverter and 'allow_extra_attributes' => false unexpected behaviours

3 participants