[TASK] Do not respect autoload info if core repo is composer root 73/37373/2
authorHelmut Hummel <helmut.hummel@typo3.org>
Sat, 28 Feb 2015 20:33:18 +0000 (21:33 +0100)
committerHelmut Hummel <helmut.hummel@typo3.org>
Sat, 28 Feb 2015 20:55:54 +0000 (21:55 +0100)
Doing a composer install directly in typo3 source has been
a requirement for core development for a while and a convenient shortcut
to quickly set up a TYPO3 installation for executing tests for extensions.

Respecting the class loading information generated in that location is
unfortunate however as it would require editing of the core composer.json
if additional classes from the core should respected.

Instead of respecting this as valid composer autoload file location,
we always fall back to the hard coded and committed class loading info
if no autoload file of a composer distribution call is found.

Releases: master, 6.2
Resolves: #65420
Change-Id: I1953303c6d2b5b221017deb7d2d7a0b43e4d08bf
Reviewed-on: http://review.typo3.org/37373
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
typo3/sysext/core/Classes/Core/Bootstrap.php

index 4ef6ff0..b6f35f5 100644 (file)
@@ -173,17 +173,19 @@ class Bootstrap {
         */
        static protected function initializeComposerClassLoader() {
                $possiblePaths = array(
-                       'distribution is root package' => __DIR__ . '/../../../../../../Packages/Libraries/autoload.php',
-                       'typo3/cms is root package' => __DIR__ . '/../../../../../Packages/Libraries/autoload.php',
+                       'distribution' => __DIR__ . '/../../../../../../Packages/Libraries/autoload.php',
+                       'fallback' => __DIR__ . '/../../../../contrib/vendor/autoload.php',
                );
-               foreach ($possiblePaths as $possiblePath) {
+               foreach ($possiblePaths as $autoLoadType => $possiblePath) {
                        if (file_exists($possiblePath)) {
-                               self::$usesComposerClassLoading = TRUE;
+                               if ($autoLoadType === 'distribution') {
+                                       self::$usesComposerClassLoading = TRUE;
+                               }
                                return include $possiblePath;
                        }
                }
-               // Committed vendor dir in typo3/contrib
-               return require __DIR__ . '/../../../../contrib/vendor/autoload.php';
+
+               throw new \LogicException('No class loading information found for TYPO3 CMS. Please make sure you installed TYPO3 with composer or the typo3/contrib/vendor folder is present.', 1425153762);
        }
 
        /**