8000 bug #48916 [FrameworkBundle] restore call to addGlobalIgnoredName (al… · symfony/symfony@996f93e · GitHub
[go: up one dir, main page]

Skip to content

Commit 996f93e

Browse files
bug #48916 [FrameworkBundle] restore call to addGlobalIgnoredName (alexislefebvre)
This PR was merged into the 5.4 branch. Discussion ---------- [FrameworkBundle] restore call to addGlobalIgnoredName | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #48792 and replace #48912 | License | MIT | Doc PR | no The service `annotations.dummy_registry` is unregistered with `doctrine/annotations` v2. This had the unexpected effect to break the call to `addGlobalIgnoredName` with `doctrine/annotations` v2 : #48792 (comment) By using `nullOnInvalid` instead of `ignoreOnInvalid`, the call to `addGlobalIgnoredName` is restored. These changes can be tested with this reproducer: https://github.com/alexislefebvre/symfony_bug_app_48792 Downgrading and upgrading `doctrine/annotations` become possible: ```bash composer require doctrine/annotations:^1.13.0 --with-all-dependencies composer require doctrine/annotations:^2.0 --with-all-dependencies ``` Thanks to `@derrabus`: #48912 (comment) Commits ------- e058874 [FrameworkBundle] restore call to addGlobalIgnoredName
2 parents 5af54d3 + e058874 commit 996f93e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,11 +1631,14 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
16311631

16321632
$loader->load('annotations.php');
16331633

1634+
// registerUniqueLoader exists since doctrine/annotations v1.6
16341635
if (!method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) {
1636+
// registerLoader exists only in doctrine/annotations v1
16351637
if (method_exists(AnnotationRegistry::class, 'registerLoader')) {
16361638
$container->getDefinition('annotations.dummy_registry')
16371639
->setMethodCalls([['registerLoader', ['class_exists']]]);
16381640
} else {
1641+
// remove the dummy registry when doctrine/annotations v2 is used
16391642
$container->removeDefinition('annotations.dummy_registry');
16401643
}
16411644
}

src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
->set('annotations.reader', AnnotationReader::class)
2727
->call('addGlobalIgnoredName', [
2828
'required',
29-
service('annotations.dummy_registry')->ignoreOnInvalid(), // dummy arg to register class_exists as annotation loader only when required
29+
service('annotations.dummy_registry')->nullOnInvalid(), // dummy arg to register class_exists as annotation loader only when required
3030
])
3131

3232
->set('annotations.dummy_registry', AnnotationRegistry::class)

0 commit comments

Comments
 (0)
0