8000 bug #46625 [FrameworkBundle] Disable Serializer data collect by defau… · symfony/symfony@3184226 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3184226

Browse files
bug #46625 [FrameworkBundle] Disable Serializer data collect by default (chalasr)
This PR was merged into the 6.1 branch. Discussion ---------- [FrameworkBundle] Disable Serializer data collect by default | Q | A | ------------- | --- | Branch? | 6.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #46471 | License | MIT | Doc PR | TODO The serializer data collector introduced in 6.1. causes a BC break for some (see fixed ticket). This PR adds a `framework.profiler.collect_serializer_data` option defaulting to `false`, allowing people to fix their code before activating it. Next steps: - deprecate the `ObjectNormalizer` autowiring alias on 6.2 and fix the docs accordingly - deprecate the option Build failures unrelated. Commits ------- d0cf759 [FrameworkBundle] Disable Serializer data collect by default
2 parents 6e0ab3a + d0cf759 commit 3184226

File tree

12 files changed

+61
-1
lines changed

12 files changed

+61
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
< 10000 /tr>
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ CHANGELOG
1515
* Add tag `routing.condition_service` to autoconfigure routing condition services
1616
* Automatically register kernel methods marked with the `Symfony\Component\Routing\Annotation\Route` attribute or annotation as controllers in `MicroKernelTrait`
1717
* Deprecate not setting the `http_method_override` config option. The default value will change to `false` in 7.0.
18+
* Add `framework.profiler.collect_serializer_data` config option, set it to `true` to enable the serializer data collector and profiler panel
1819

1920
6.0
2021
---

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ private function addProfilerSection(ArrayNodeDefinition $rootNode)
325325
->booleanNode('only_exceptions')->defaultFalse()->end()
326326
->booleanNode('only_main_requests')->defaultFalse()->end()
327327
->scalarNode('dsn')->defaultValue('file:%kernel.cache_dir%/profiler')->end()
328+
->booleanNode('collect_serializer_data')->info('Enables the serializer data collector and profiler panel')->defaultFalse()->end()
328329
->end()
329330
->end()
330331
->end()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ private function registerProfilerConfiguration(array $config, ContainerBuilder $
826826
$loader->load('notifier_debug.php');
827827
}
828828

829-
if ($this->serializerConfigEnabled) {
829+
if ($this->serializerConfigEnabled && $config['collect_serializer_data']) {
830830
$loader->load('serializer_debug.php');
831831
}
832832

src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
<xsd:attribute name="username" type="xsd:string" />
104104
<xsd:attribute name="password" type="xsd:string" />
105105
<xsd:attribute name="lifetime" type="xsd:string" />
106+
<xsd:attribute name="collect-serializer-data" type="xsd:boolean" />
106107
</xsd:complexType>
107108

108109
<xsd:complexType name="router">

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ protected static function getBundleDefaultConfig()
468468
'dsn' => 'file:%kernel.cache_dir%/profiler',
469469
'collect' => true,
470470
'collect_parameter' => null,
471+
'collect_serializer_data' => false,
471472
],
472473
'translator' => [
473474
'enabled' => !class_exists(FullStack::class),

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/profiler.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@
55
'profiler' => [
66
'enabled' => true,
77
],
8+
'serializer' => [
9+
'enabled' => true
10+
],
811
]);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
$container->loadFromExtension('framework', [
4+
'http_method_override' => false,
5+
'profiler' => [
6+
'enabled' => true,
7+
'collect_serializer_data' => true,
8+
],
9+
'serializer' => [
10+
'enabled' => true,
11+
]
12+
]);

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/profiler.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88

99
<framework:config http-method-override="false">
1010
<framework:profiler enabled="true" />
11+
<framework:serializer enabled="true" />
1112
</framework:config>
1213
</container>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" ?>
2+
3+
<container xmlns="http://symfony.com/schema/dic/services"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xmlns:framework="http://symfony.com/schema/dic/symfony"
6+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
7+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
8+
9+
<framework:config http-method-override="false">
10+
<framework:profiler enabled="true" collect-serializer-data="true" />
11+
<framework:serializer enabled="true" />
12+
</framework:config>
13+
</container>

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/profiler.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ framework:
22
http_method_override: false
33
profiler:
44
enabled: true
5+
serializer:
6+
enabled: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
framework:
2+
http_method_override: false
3+
serializer:
4+
enabled: true
5+
profiler:
6+
enabled: true
7+
collect_serializer_data: true

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,24 @@ public function testDisabledProfiler()
253253
$this->assertFalse($container->hasDefinition('data_collector.config'), '->registerProfilerConfiguration() does not load collectors.xml');
254254
}
255255

256+
public function testProfilerCollectSerializerDataEnabled()
257+
{
258+
$container = $this->createContainerFromFile('profiler_collect_serializer_data');
259+
260+
$this->assertTrue($container->hasDefinition('profiler'));
261+
$this->assertTrue($container->hasDefinition('serializer.data_collector'));
262+
$this->assertTrue($container->hasDefinition('debug.serializer'));
263+
}
264+
265+
public function testProfilerCollectSerializerDataDefaultDisabled()
266+
{
267+
$container = $this->createContainerFromFile('profiler');
268+
269+
$this->assertTrue($container->hasDefinition('profiler'));
270+
$this->assertFalse($container->hasDefinition('serializer.data_collector'));
271+
$this->assertFalse($container->hasDefinition('debug.serializer'));
272+
}
273+
256274
public function testWorkflows()
257275
{
258276
$container = $this->createContainerFromFile('workflows');

0 commit comments

Comments
 (0)
0