[BUGFIX] Fatal error is thrown when more drivers are registered
authorNicole Cordes <n.cordes@biz-design.biz>
Tue, 11 Sep 2012 22:13:42 +0000 (00:13 +0200)
committerSteffen Ritter <info@rs-websystems.de>
Mon, 17 Sep 2012 17:12:56 +0000 (19:12 +0200)
Due to some extension manager processes when installing a new extension
the DriveRegistry has to support to register the same short name with the
same class name multiple times.

Change-Id: I67e409f532f5736b5a4c0a2e7fb822a579cfaa41
Fixes: #40843
Releases: 6.0
Reviewed-on: http://review.typo3.org/14532
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
typo3/sysext/core/Classes/Resource/Driver/DriverRegistry.php

index fd127e5..25dadbf 100644 (file)
@@ -74,7 +74,12 @@ class DriverRegistry implements \TYPO3\CMS\Core\SingletonInterface {
                        $shortName = $className;
                }
                if (array_key_exists($shortName, $this->drivers)) {
-                       throw new \InvalidArgumentException('Driver ' . $shortName . ' is already registered.', 1314979451);
+                               // Return immediately without changing configuration
+                       if ($this->drivers[$shortName] === $className) {
+                               return TRUE;
+                       } else {
+                               throw new \InvalidArgumentException('Driver ' . $shortName . ' is already registered.', 1314979451);
+                       }
                }
                $this->drivers[$shortName] = $className;
                $this->driverConfigurations[$shortName] = array(