8000 [FrameworkBundle] Disable Serializer data collect by default by chalasr · Pull Request #46625 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[FrameworkBundle] Disable Serializer data collect by default #46625

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

Merged
merged 1 commit into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
[FrameworkBundle] Disable Serializer data collect by default
  • Loading branch information
chalasr committed Jun 9, 2022
commit d0cf7594896eee5ff46bdb40743e8eac9b7eb9df
1 change: 1 addition & 0 deletions src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ CHANGELOG
* Add tag `routing.condition_service` to autoconfigure routing condition services
* Automatically register kernel methods marked with the `Symfony\Component\Routing\Annotation\Route` attribute or annotation as controllers in `MicroKernelTrait`
* Deprecate not setting the `http_method_override` config option. The default value will change to `false` in 7.0.
* Add `framework.profiler.collect_serializer_data` config option, set it to `true` to enable the serializer data collector and profiler panel

6.0
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ private function addProfilerSection(ArrayNodeDefinition $rootNode)
->booleanNode('only_exceptions')->defaultFalse()->end()
->booleanNode('only_main_requests')->defaultFalse()->end()
->scalarNode('dsn')->defaultValue('file:%kernel.cache_dir%/profiler')->end()
->booleanNode('collect_serializer_data')->info('Enables the serializer data collector and profiler panel')->defaultFalse()->end()
->end()
->end()
->end()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ private function registerProfilerConfiguration(array $config, ContainerBuilder $
$loader->load('notifier_debug.php');
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
<xsd:attribute name="username" type="xsd:string" />
<xsd:attribute name="password" type="xsd:string" />
<xsd:attribute name="lifetime" type="xsd:string" />
<xsd:attribute name="collect-serializer-data" type="xsd:boolean" />
</xsd:complexType>

<xsd:complexType name="router">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ protected static function getBundleDefaultConfig()
'dsn' => 'file:%kernel.cache_dir%/profiler',
'collect' => true,
'collect_parameter' => null,
'collect_serializer_data' => false,
],
'translator' => [
'enabled' => !class_exists(FullStack::class),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@
'profiler' => [
'enabled' => true,
],
'serializer' => [
'enabled' => true
],
]);
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

$container->loadFromExtension('framework', [
'http_method_override' => false,
'profiler' => [
'enabled' => true,
'collect_serializer_data' => true,
],
'serializer' => [
'enabled' => true,
]
]);
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@

<framework:config http-method-override="false">
<framework:profiler enabled="true" />
<framework:serializer enabled="true" />
</framework:config>
</container>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<framework:config http-method-override="false">
<framework:profiler enabled="true" collect-serializer-data="true" />
<framework:serializer enabled="true" />
</framework:config>
</container>
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ framework:
http_method_override: false
profiler:
enabled: true
serializer:
enabled: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
framework:
http_method_override: false
serializer:
enabled: true
profiler:
enabled: true
collect_serializer_data: true
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,24 @@ public function testDisabledProfiler()
$this->assertFalse($container->hasDefinition('data_collector.config'), '->registerProfilerConfiguration() does not load collectors.xml');
}

public function testProfilerCollectSerializerDataEnabled()
{
$container = $this->createContainerFromFile('profiler_collect_serializer_data');

$this->assertTrue($container->hasDefinition('profiler'));
$this->assertTrue($container->hasDefinition('serializer.data_collector'));
$this->assertTrue($container->hasDefinition('debug.serializer'));
}

public function testProfilerCollectSerializerDataDefaultDisabled()
{
$container = $this->createContainerFromFile('profiler');

$this->assertTrue($container->hasDefinition('profiler'));
$this->assertFalse($container->hasDefinition('serializer.data_collector'));
$this->assertFalse($container->hasDefinition('debug.serializer'));
}

public function testWorkflows()
{
$container = $this->createContainerFromFile('workflows');
Expand Down
0