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

Appearance settings

Commit fd00244

Browse filesBrowse files
committed
do not overwrite the cache key when it is false
1 parent 4eb23d8 commit fd00244
Copy full SHA for fd00244

File tree

2 files changed

+1
-16
lines changed
Filter options

2 files changed

+1
-16
lines changed

‎src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ protected function createChildContext(array $parentContext, string $attribute, ?
783783
$context = parent::createChildContext($parentContext, $attribute, $format);
784784
if ($context['cache_key'] ?? false) {
785785
$context['cache_key'] .= '-'.$attribute;
786-
} else {
786+
} elseif (false !== ($context['cache_key'] ?? null)) {
787787
$context['cache_key'] = $this->getCacheKey($format, $context);
788788
}
789789

‎src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php
-15Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -555,11 +555,6 @@ public function testProvidingContextCacheKeyGeneratesSameChildContextCacheKey()
555555
$foobar->foo = new EmptyDummy();
556556
$foobar->bar = 'bar';
557557
$foobar->baz = 'baz';
558-
$data = [
559-
'foo' => [],
560-
'bar' => 'bar',
561-
'baz' => 'baz',
562-
];
563558

564559
$normalizer = new class() extends AbstractObjectNormalizerDummy {
565560
public $childContextCacheKey;
@@ -600,11 +595,6 @@ public function testChildContextKeepsOriginalContextCacheKey()
600595
$foobar->foo = new EmptyDummy();
601596
$foobar->bar = 'bar';
602597
$foobar->baz = 'baz';
603-
$data = [
604-
'foo' => [],
605-
'bar' => 'bar',
606-
'baz' => 'baz',
607-
];
608598

609599
$normalizer = new class() extends AbstractObjectNormalizerDummy {
610600
public $childContextCacheKey;
@@ -640,11 +630,6 @@ public function testChildContextCacheKeyStaysFalseWhenOriginalCacheKeyIsFalse()
640630
$foobar->foo = new EmptyDummy();
641631
$foobar->bar = 'bar';
642632
$foobar->baz = 'baz';
643-
$data = [
644-
'foo' => [],
645-
'bar' => 'bar',
646-
'baz' => 'baz',
647-
];
648633

649634
$normalizer = new class() extends AbstractObjectNormalizerDummy {
650635
public $childContextCacheKey;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.