Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Serializer] Fix support of plain object types denormalization#52804

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 1 commit intosymfony:5.4fromandersonamuller:patch-7
Dec 1, 2023
Merged

[Serializer] Fix support of plain object types denormalization#52804

nicolas-grekas merged 1 commit intosymfony:5.4fromandersonamuller:patch-7
Dec 1, 2023

Conversation

@andersonamuller
Copy link
Contributor

@andersonamullerandersonamuller commentedNov 29, 2023
edited by nicolas-grekas
Loading

QA
Branch?5.4
Bug fix?yes
New feature?no
Deprecations?no
Issues
LicenseMIT

When denormalizing properties with a plainobject type without a class theObjectNormalizer would fail with aTypeError.

@carsonbotcarsonbot added this to the5.4 milestoneNov 29, 2023
@andersonamullerandersonamuller changed the titleFix support of plain object types denormalization[Serializer] Fix support of plain object types denormalizationNov 29, 2023
@OskarStark
Copy link
Contributor

Can you please add test case to avoid further regressions? Thank you!

@andersonamuller
Copy link
ContributorAuthor

Can you please add test case to avoid further regressions? Thank you!

I added a test case

@OskarStark
Copy link
Contributor

friendly ping@mtarld as you are deeply involved in the serializer component, thanks!

Copy link
Contributor

@mtarldmtarld left a comment

Choose a reason for hiding this comment

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

I'd do instead:

if (Type::BUILTIN_TYPE_OBJECT ===$builtinType &&null !==$class) {

By doing that, it'll fallback to:

if (('is_'.$builtinType)($data)) {

And IMHO, it might be better to handle a raw object as a builtin type. WDYT?

@andersonamuller
Copy link
ContributorAuthor

I'd do instead:

if (Type::BUILTIN_TYPE_OBJECT === $builtinType && null !== $class) {

By doing that, it'll fallback to:

if (('is_'.$builtinType)($data)) {

And IMHO, it might be better to handle a raw object as a builtin type. WDYT?

Makes sense, I have pushed the change.

When denormalizing properties with a plain `object` type without a class the `ObjectNormalizer` would fail with a `TypeError`.
@carsonbotcarsonbot changed the title[Serializer] Fix support of plain object types denormalizationFix support of plain object types denormalizationDec 1, 2023
@carsonbotcarsonbot changed the titleFix support of plain object types denormalization[Serializer] Fix support of plain object types denormalizationDec 1, 2023
@nicolas-grekas
Copy link
Member

Thank you@andersonamuller.

andersonamuller reacted with hooray emoji

@nicolas-grekasnicolas-grekas merged commit410490c intosymfony:5.4Dec 1, 2023
This was referencedDec 1, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@mtarldmtarldmtarld approved these changes

@dunglasdunglasAwaiting requested review from dunglasdunglas is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

5.4

Development

Successfully merging this pull request may close these issues.

5 participants

@andersonamuller@OskarStark@nicolas-grekas@mtarld@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp