Issue Bug Closed

#51474Empty ext_autoload.php results in empty classRegistry

Michel Georgy 08/28/13, 19:10 updated 10/02/18, 12:10

Description

If an extension has an empty ext_autoload.php or does not return an array in ext_autoload.php
all other ext_autoload.php entries are lost, because of an array_merge with a NULL value.

The required extensionAutoloadFile should be casted to an array to prevent this issue.

\TYPO3\CMS\Core\Core\ClassLoader.php

static protected function createCoreAndExtensionRegistry(){
...
$classRegistry = array_merge($classRegistry, require $extensionAutoloadFile);
...

should be changed to:

...
$classRegistry = array_merge($classRegistry, (array) require $extensionAutoloadFile);
...

To reproduce create an empty ext_autoload.php in an Extension and for example try to add a media file to a page record in the backend.
The class TBE_FolderTree fails to load which has an ext_autoload.php from the core extension with following error message:

Fatal error: Class '\TBE_FolderTree' not found in /MyPath/typo3_src-6.1.3/typo3/sysext/core/Classes/Utility/GeneralUtility.php on line 4111

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.