[BUGFIX] Do not devlog bad code smells of core classes 54/52054/3
authorMarkus Klein <markus.klein@typo3.org>
Sun, 12 Mar 2017 15:58:51 +0000 (16:58 +0100)
committerMarkus Klein <markus.klein@typo3.org>
Mon, 3 Apr 2017 21:44:04 +0000 (23:44 +0200)
Releases: 7.6, 6.2
Resolves: #48544
Change-Id: If58f3a5c9c6a1003a0301bd2d68622ee8ccba843
Reviewed-on: https://review.typo3.org/52054
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Thomas Hohn <thomas@hohn.dk>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Mathias Bruckmoser <dev@abavo.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/extbase/Classes/Object/Container/Container.php

index 344aa29..c2de4a1 100644 (file)
@@ -227,7 +227,10 @@ class Container implements \TYPO3\CMS\Core\SingletonInterface
         }
         foreach ($classInfo->getInjectMethods() as $injectMethodName => $classNameToInject) {
             $instanceToInject = $this->getInstanceInternal($classNameToInject);
-            if ($classInfo->getIsSingleton() && !$instanceToInject instanceof \TYPO3\CMS\Core\SingletonInterface) {
+            if (
+                $classInfo->getIsSingleton() && !$instanceToInject instanceof \TYPO3\CMS\Core\SingletonInterface
+                && strpos($classNameToInject, 'TYPO3\CMS') === false
+            ) {
                 $this->log('The singleton "' . $classInfo->getClassName() . '" needs a prototype in "' . $injectMethodName . '". This is often a bad code smell; often you rather want to inject a singleton.', 1);
             }
             if (is_callable([$instance, $injectMethodName])) {