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 e6ada5e

Browse filesBrowse files
committed
Register only if the class exists
1 parent 9ee93b1 commit e6ada5e
Copy full SHA for e6ada5e

File tree

Expand file treeCollapse file tree

3 files changed

+12
-5
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+12
-5
lines changed

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use Symfony\Component\Finder\Finder;
2424
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
2525
use Symfony\Component\Config\FileLocator;
26+
use Symfony\Component\Serializer\Normalizer\DataUriNormalizer;
2627
use Symfony\Component\Validator\Validation;
2728

2829
/**
@@ -894,6 +895,13 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
894895
return;
895896
}
896897

898+
if (class_exists('Symfony\Component\Serializer\Normalizer\DataUriNormalizer')) {
899+
// Run after serializer.normalizer.object
900+
$definition = $container->register('serializer.normalizer.data_uri', DataUriNormalizer::class);
901+
$definition->setPublic(false);
902+
$definition->addTag('serializer.normalizer', -920);
903+
}
904+
897905
$loader->load('serializer.xml');
898906
$chainLoader = $container->getDefinition('serializer.mapping.chain_loader');
899907

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml
-5Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@
2626
<tag name="serializer.normalizer" priority="-1000" />
2727
</service>
2828

29-
<service id="serializer.normalizer.data_uri" class="Symfony\Component\Serializer\Normalizer\DataUriNormalizer">
30-
<!-- Run after serializer.normalizer.object -->
31-
<tag name="serializer.normalizer" priority="-920" />
32-
</service>
33-
3429
<!-- Loader -->
3530
<service id="serializer.mapping.chain_loader" class="Symfony\Component\Serializer\Mapping\Loader\LoaderChain" public="false">
3631
<argument type="collection" />

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,10 @@ public function testRegisterSerializerExtractor()
456456

457457
public function testDataUriNormalizerRegistered()
458458
{
459+
if (!class_exists('Symfony\Component\Serializer\Normalizer\DataUriNormalizer')) {
460+
$this->markTestSkipped('The DataUriNormalizer has been introduced in the Serializer Component version 3.1.');
461+
}
462+
459463
$container = $this->createContainerFromFile('full');
460464

461465
$definition = $container->getDefinition('serializer.normalizer.data_uri');

0 commit comments

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