Bug #95305
closed
ExtensionManagementUtility::isLoaded() cannot be used in Configuration/Services.php
Added by Chris Müller almost 3 years ago.
Updated almost 3 years ago.
Category:
System/Bootstrap/Configuration
Description
When using the following code in Configuration/Services.php to check if an extension is loaded:
return function (ContainerConfigurator $configurator): void {
if (!ExtensionManagementUtility::isLoaded('dashboard')) {
return;
}
// ... register widgets
}
the following exception is thrown:
Call to a member function isPackageActive() on null
in /var/www/html/public/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php line 120
This is since TYPO3 11.4, in 11.3 it worked.
- Category set to System/Bootstrap/Configuration
Maybe related when importing a site configuration from an extension:
Example:
config/sites/main/config.yaml
imports:
- { resource: 'EXT:myext/Configuration/Sites/config.yaml' }
throws the same exception:
Call to a member function isPackageActive() on null
in /var/www/html/public/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php line 120
at TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('myext')
in /var/www/html/public/typo3/sysext/core/Classes/Utility/GeneralUtility.php line 2816
at TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('')
in /var/www/html/public/typo3/sysext/core/Classes/Configuration/Loader/YamlFileLoader.php line 125
at TYPO3\CMS\Core\Configuration\Loader\YamlFileLoader->getStreamlinedFileName('EXT:myext/Configuration/Sites/config.yaml', '/var/www/html/config/sites/main/config.yaml')
in /var/www/html/public/typo3/sysext/core/Classes/Configuration/Loader/YamlFileLoader.php line 81
- Is duplicate of Bug #95327: Push PackageManager to ExtensionManagementUtility in bootstrap added
- Status changed from New to Resolved
- Has duplicate Bug #95401: Site configuration imports broken in v11.4 added
- Status changed from Resolved to Closed
Also available in: Atom
PDF