Project

General

Profile

Actions

Bug #94936

closed

ext_localconf.php is loaded twice when installing via the extension manager

Added by Niels Jensen over 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extension Manager
Target version:
-
Start date:
2021-08-19
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.4
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

When I install an extension manually via the extension manager in a non-composer installation, all ext_localconf.php files are reloaded in the method "reloadCaches" of the class TYPO3\CMS\Extensionmanager\Utility\InstallUtility. Since some extensions append entries to a global array here (e.g. $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = ... ) this leads to these entries being added twice (see screenshot).

Is this intentional?

This behavior recently caused a problem for me:
  • The extension "yoast_news" registers its own class this way: $GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['classes']['Domain/Model/News'][] = 'yoast_news';
  • The extension "news" generates a merged cache file from these entries
  • Since the same class was registered twice (caused by the above behavior) the class was also written twice to the cache file resulting in a fatal error "cannot redeclare ...".

However, this problem only occurs in a very special scenario in combination of the extension "flux", which was used to register custom content elements in whose template files certain ViewHelpers were called (e.g. <f:form>...</f:form> ).

Therefore my question: Is it the task of the extension developers to make sure that identical entries in the global arrays are not processed multiple times, or should I as a developer be able to assume that the ext_localconf.php is loaded only once?


Files

before_reloadCaches.png (345 KB) before_reloadCaches.png Niels Jensen, 2021-08-19 13:59
after_reloadCaches.png (423 KB) after_reloadCaches.png Niels Jensen, 2021-08-19 13:59
Actions #1

Updated by Benni Mack about 3 years ago

  • Status changed from New to Closed

I suggest that extension developers use a numeric or assoc array key when registering hooks.

Before:

$GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['classes']['Domain/Model/News'][] = 'yoast_seo';

After

$GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['classes']['Domain/Model/News']['yoast_seo'] = 'yoast_seo';

Nothing we can do from Core side.

Actions

Also available in: Atom PDF