Skip to content

Commit

Permalink
Merge branch '5.4' into 6.3
Browse files Browse the repository at this point in the history
* 5.4:
  [String] Update wcswidth data with Unicode 15.1
  [FrameworkBundle] no serializer mapping cache in debug mode without enable_annotations
  [Cache] fix using multiple Redis Sentinel hosts when the first one is not resolvable
  • Loading branch information
derrabus committed Sep 18, 2023
2 parents f822f54 + 96b37be commit f029827
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions DependencyInjection/FrameworkExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -1867,6 +1867,10 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
$container->removeDefinition('serializer.normalizer.mime_message');
}

if ($container->getParameter('kernel.debug')) {
$container->removeDefinition('serializer.mapping.cache_class_metadata_factory');
}

// compat with Symfony < 6.3
if (!is_subclass_of(ProblemNormalizer::class, SerializerAwareInterface::class)) {
$container->getDefinition('serializer.normalizer.problem')
Expand All @@ -1875,10 +1879,6 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder

$serializerLoaders = [];
if (isset($config['enable_annotations']) && $config['enable_annotations']) {
if ($container->getParameter('kernel.debug')) {
$container->removeDefinition('serializer.mapping.cache_class_metadata_factory');
}

$annotationLoader = new Definition(
AnnotationLoader::class,
[new Reference('annotation_reader', ContainerInterface::NULL_ON_INVALID_REFERENCE)]
Expand Down
6 changes: 6 additions & 0 deletions Tests/DependencyInjection/FrameworkExtensionTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -1572,6 +1572,12 @@ public function testSerializerCacheActivated()
public function testSerializerCacheUsedWithoutAnnotationsAndMappingFiles()
{
$container = $this->createContainerFromFile('serializer_mapping_without_annotations', ['kernel.debug' => true, 'kernel.container_class' => __CLASS__]);
$this->assertFalse($container->hasDefinition('serializer.mapping.cache_class_metadata_factory'));
}

public function testSerializerCacheUsedWithoutAnnotationsAndMappingFilesNoDebug()
{
$container = $this->createContainerFromFile('serializer_mapping_without_annotations', ['kernel.debug' => false, 'kernel.container_class' => __CLASS__]);
$this->assertTrue($container->hasDefinition('serializer.mapping.cache_class_metadata_factory'));
}

Expand Down

0 comments on commit f029827

Please # to comment.