8000 [Serializer] Fix AbstractObjectNormalizer TypeError on denormalization by JustDylan23 · Pull Request #44881 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Serializer] Fix AbstractObjectNormalizer TypeError on denormalization #44881

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

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
ticket_44872 added unit test to reproduce #44872
  • Loading branch information
JustDylan23 committed Dec 31, 2021
commit 8d3da317dee3449a9f8d3f6e47e0a6679530a31e
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,17 @@ public function testDenomalizeRecursive()
$this->assertSame(2, $obj->getInners()[1]->foo);
}

public function testDenomalizeRecursiveWithObjectAttributeWithStringValue()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public function testDenomalizeRecursiveWithObjectAttributeWithStringValue()
public function testDenormalizeRecursiveWithObjectAttributeWithStringValue()

{
$extractor = new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$extractor = new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]);
$extractor = new ReflectionExtractor();

$normalizer = new ObjectNormalizer(null, null, null, $extractor);
$serializer = new Serializer([new ArrayDenormalizer(), new DateTimeNormalizer(), $normalizer]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$serializer = new Serializer([new ArrayDenormalizer(), new DateTimeNormalizer(), $normalizer]);
$serializer = new Serializer([$normalizer]);


$this->expectException(UnexpectedValueException::class);

$serializer->denormalize(['inner' => 'foo'], ObjectOuter::class);
}

public function testAcceptJsonNumber()
{
$extractor = new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]);
Expand Down
0