Skip to content

Commit 399b79f

Browse files
committed
Merge branch '3.4'
* 3.4: [TwigBridge] Bootstrap 4 form theme fixes [VarDumper] HtmlDumper: fix collapsing nodes with depth <= maxDepth Fixing a bug where non-existent classes would cause issues Do not activate the cache if Doctrine's cache is not present [SecurityBundle] hotfix: update phpdocs on logout url [FrameworkBundle] Do not load property_access.xml if the component isn't installed [HttpFoundation] Mark new methods on Response as final Fixed a few spelling mistakes in Luxembourgish translation [TwigBridge] Fix template paths in profiler
2 parents 6bdd707 + 53639a8 commit 399b79f

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

Command/ContainerDebugCommand.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,18 @@ public function filterToServiceTypes($serviceId)
242242
return false;
243243
}
244244

245-
// see if the class exists (only need to trigger autoload once)
246-
return class_exists($serviceId) || interface_exists($serviceId, false);
245+
// if the id has a \, assume it is a class
246+
if (false !== strpos($serviceId, '\\')) {
247+
return true;
248+
}
249+
250+
try {
251+
$r = new \ReflectionClass($serviceId);
252+
253+
return true;
254+
} catch (\ReflectionException $e) {
255+
// the service id is not a valid class/interface
256+
return false;
257+
}
247258
}
248259
}

DependencyInjection/Configuration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection;
1313

1414
use Doctrine\Common\Annotations\Annotation;
15+
use Doctrine\Common\Cache\Cache;
1516
use Symfony\Bundle\FullStack;
1617
use Symfony\Component\Asset\Package;
1718
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
@@ -676,7 +677,7 @@ private function addAnnotationsSection(ArrayNodeDefinition $rootNode)
676677
->info('annotation configuration')
677678
->{class_exists(Annotation::class) ? 'canBeDisabled' : 'canBeEnabled'}()
678679
->children()
679-
->scalarNode('cache')->defaultValue('php_array')->end()
680+
->scalarNode('cache')->defaultValue(interface_exists(Cache::class) ? 'php_array' : 'none')->end()
680681
->scalarNode('file_cache_dir')->defaultValue('%kernel.cache_dir%/annotations')->end()
681682
->booleanNode('debug')->defaultValue($this->debug)->end()
682683
->end()

DependencyInjection/FrameworkExtension.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,6 @@ public function load(array $configs, ContainerBuilder $container)
127127
}
128128
}
129129

130-
// Property access is used by both the Form and the Validator component
131-
$loader->load('property_access.xml');
132-
133130
// Load Cache configuration first as it is used by other components
134131
$loader->load('cache.xml');
135132

@@ -237,7 +234,7 @@ public function load(array $configs, ContainerBuilder $container)
237234
$this->registerDebugConfiguration($config['php_errors'], $container, $loader);
238235
$this->registerRouterConfiguration($config['router'], $container, $loader);
239236
$this->registerAnnotationsConfiguration($config['annotations'], $container, $loader);
240-
$this->registerPropertyAccessConfiguration($config['property_access'], $container);
237+
$this->registerPropertyAccessConfiguration($config['property_access'], $container, $loader);
241238

242239
if ($this->isConfigEnabled($container, $config['serializer'])) {
243240
$this->registerSerializerConfiguration($config['serializer'], $container, $loader);
@@ -1096,8 +1093,14 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
10961093
}
10971094
}
10981095

1099-
private function registerPropertyAccessConfiguration(array $config, ContainerBuilder $container)
1096+
private function registerPropertyAccessConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
11001097
{
1098+
if (!class_exists('Symfony\Component\PropertyAccess\PropertyAccessor')) {
1099+
return;
1100+
}
1101+
1102+
$loader->load('property_access.xml');
1103+
11011104
$container
11021105
->getDefinition('property_accessor')
11031106
->replaceArgument(0, $config['magic_call'])
@@ -1133,6 +1136,11 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
11331136

11341137
$chainLoader = $container->getDefinition('serializer.mapping.chain_loader');
11351138

1139+
if (!class_exists('Symfony\Component\PropertyAccess\PropertyAccessor')) {
1140+
$container->removeAlias('serializer.property_accessor');
1141+
$container->removeDefinition('serializer.normalizer.object');
1142+
}
1143+
11361144
$serializerLoaders = array();
11371145
if (isset($config['enable_annotations']) && $config['enable_annotations']) {
11381146
if (!$this->annotationsConfigEnabled) {

0 commit comments

Comments
 (0)