Bug #94936
closedext_localconf.php is loaded twice when installing via the extension manager
0%
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
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.