[BUGFIX] ClassLoader error after installing extension
authorOliver Hader <oliver@typo3.org>
Wed, 28 Nov 2012 10:42:33 +0000 (11:42 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 30 Nov 2012 16:39:00 +0000 (17:39 +0100)
When e.g. installing tt_news version 3.4.0 (compatible to
TYPO3 CMS 6.0.0) a fatal error will be shown since tt_news
uses a class in ext_tables.php that requires the autoloader's
registry information.

The following happens on installing an extension:
* flushing the caches (including the class loader cache)
* redirecting to list view of extension manager
* triggering shutdown method in ClassLoader
* updating cache if $cacheUpdateRequired is set

This updates the autoloader registry with old data since
the extension's ext_autoload.php has not been considered at
that time.

The issue is fixed by explicitly reloading the ClassLoader
cache after TYPO3_LOADED_EXT has been reloaded.

Change-Id: Ifd2240bf004dbdfd34ded76618a5650f7af08d0e
Fixes: #43381
Releases: 6.0, 6.1
Reviewed-on: http://review.typo3.org/16893
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Classes/Core/ClassLoader.php
typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php

index 795cf62..985c375 100644 (file)
@@ -164,6 +164,21 @@ class Bootstrap {
        }
 
        /**
+        * Load TYPO3_LOADED_EXT, recreate class loader registry and load ext_localconf
+        *
+        * @param boolean $allowCaching
+        * @return \TYPO3\CMS\Core\Core\Bootstrap
+        * @internal This is not a public API method, do not use in own extensions
+        */
+       public function reloadTypo3LoadedExtAndClassLoaderAndExtLocalconf() {
+               $bootstrap = $this->getInstance();
+               $bootstrap->populateTypo3LoadedExtGlobal(FALSE);
+               \TYPO3\CMS\Core\Core\ClassLoader::loadClassLoaderCache();
+               $bootstrap->loadAdditionalConfigurationFromExtensions(FALSE);
+               return $this;
+       }
+
+       /**
         * Sets up additional configuration applied in all scopes
         *
         * @return \TYPO3\CMS\Core\Core\Bootstrap
@@ -937,4 +952,4 @@ class Bootstrap {
 }
 
 
-?>
+?>
\ No newline at end of file
index 9698f48..6596a39 100644 (file)
@@ -189,7 +189,7 @@ class ClassLoader {
         *
         * @return void
         */
-       static protected function loadClassLoaderCache() {
+       static public function loadClassLoaderCache() {
                $classRegistry = NULL;
                $aliasToClassNameMapping = NULL;
                /** @var $phpCodeCache \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend */
index ce7358d..8096b3a 100644 (file)
@@ -275,7 +275,7 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface {
                $localConfiguration = $this->configurationManager->getLocalConfiguration();
                $GLOBALS['TYPO3_CONF_VARS']['EXT']['extListArray'] = $localConfiguration['EXT']['extListArray'];
                $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'] = implode(',', $GLOBALS['TYPO3_CONF_VARS']['EXT']['extListArray']);
-               \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadTypo3LoadedExtAndExtLocalconf(FALSE);
+               \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->reloadTypo3LoadedExtAndClassLoaderAndExtLocalconf();
        }
 
        /**