[BUGFIX] ClassLoader also needs to check for interfaces 89/33489/2
authorMarkus Klein <klein.t3@reelworx.at>
Tue, 14 Oct 2014 14:13:20 +0000 (16:13 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Thu, 23 Oct 2014 19:59:30 +0000 (21:59 +0200)
An interface might already be defined, check for existence before trying
to require it, which will cause PHP errors if the interface comes from a
different file path.

Resolves: #62212
Releases: master, 6.2
Change-Id: I9cf43402bbcbbb5e27dbebb4ea48a2e1b483f360
Reviewed-on: http://review.typo3.org/33489
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/core/Classes/Core/ClassLoader.php

index 4d9b4cc..868835d 100644 (file)
@@ -177,9 +177,11 @@ class ClassLoader {
                // )
                $loadingSuccessful = FALSE;
                if (!empty($classLoadingInformation)) {
-                       // The call to class_exists fixes a rare case when early instances need to be aliased
+                       // The call to class_exists/interface_exists fixes a rare case when early instances need to be aliased
                        // but PHP fails to recognize the real path of the class. See #55904
-                       $loadingSuccessful = class_exists($classLoadingInformation[1], FALSE) || (bool)require_once $classLoadingInformation[0];
+                       $loadingSuccessful = class_exists($classLoadingInformation[1], FALSE)
+                               || interface_exists($classLoadingInformation[1], FALSE)
+                               || (bool)require_once $classLoadingInformation[0];
                }
                if ($loadingSuccessful && count($classLoadingInformation) > 2) {
                        $originalClassName = $classLoadingInformation[1];