Skip to content

Commit 53639a8

Browse files
committed
Merge branch '3.3' into 3.4
* 3.3: Fixing a bug where non-existent classes would cause issues [SecurityBundle] hotfix: update phpdocs on logout url [FrameworkBundle] Do not load property_access.xml if the component isn't installed Fixed a few spelling mistakes in Luxembourgish translation
2 parents eeda225 + 6add5e9 commit 53639a8

File tree

2 files changed

+28
-9
lines changed

2 files changed

+28
-9
lines changed

Command/ContainerDebugCommand.php

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

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

DependencyInjection/FrameworkExtension.php

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,6 @@ public function load(array $configs, ContainerBuilder $container)
159159
}
160160
}
161161

162-
// Property access is used by both the Form and the Validator component
163-
$loader->load('property_access.xml');
164-
165-
$container->getDefinition('property_accessor')->setPrivate(true);
166-
167162
// Load Cache configuration first as it is used by other components
168163
$loader->load('cache.xml');
169164

@@ -287,7 +282,7 @@ public function load(array $configs, ContainerBuilder $container)
287282
$this->registerDebugConfiguration($config['php_errors'], $container, $loader);
288283
$this->registerRouterConfiguration($config['router'], $container, $loader);
289284
$this->registerAnnotationsConfiguration($config['annotations'], $container, $loader);
290-
$this->registerPropertyAccessConfiguration($config['property_access'], $container);
285+
$this->registerPropertyAccessConfiguration($config['property_access'], $container, $loader);
291286

292287
if ($this->isConfigEnabled($container, $config['serializer'])) {
293288
$this->registerSerializerConfiguration($config['serializer'], $container, $loader);
@@ -1377,8 +1372,16 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
13771372
}
13781373
}
13791374

1380-
private function registerPropertyAccessConfiguration(array $config, ContainerBuilder $container)
1375+
private function registerPropertyAccessConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
13811376
{
1377+
if (!class_exists('Symfony\Component\PropertyAccess\PropertyAccessor')) {
1378+
return;
1379+
}
1380+
1381+
$loader->load('property_access.xml');
1382+
1383+
$container->getDefinition('property_accessor')->setPrivate(true);
1384+
13821385
$container
13831386
->getDefinition('property_accessor')
13841387
->replaceArgument(0, $config['magic_call'])
@@ -1416,6 +1419,11 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
14161419

14171420
$chainLoader = $container->getDefinition('serializer.mapping.chain_loader');
14181421

1422+
if (!class_exists('Symfony\Component\PropertyAccess\PropertyAccessor')) {
1423+
$container->removeAlias('serializer.property_accessor');
1424+
$container->removeDefinition('serializer.normalizer.object');
1425+
}
1426+
14191427
$serializerLoaders = array();
14201428
if (isset($config['enable_annotations']) && $config['enable_annotations']) {
14211429
if (!$this->annotationsConfigEnabled) {

0 commit comments

Comments
 (0)