Commit 6dbe94b6 authored by Benjamin Franzke's avatar Benjamin Franzke Committed by Oliver Bartsch
Browse files

[TASK] Revert "[BUGFIX] Push PackageManager to ExtensionManagementUtility in Bootstrap"

This reverts commit 11c7e844.

The BUGFIX accounted for ExtensionManagementUtility usage in Services.php
which has never been officially supported, but has been a documentation
bug and actually worked only by accident and only in TYPO3 core,
not with tools like typo3-console. Therefore extensions that use this
could always cause breakage in some situations.

The alternative to use optional service dependencies via
ContainerBuilder::hasDefinition() is available since v10
and the documentation is adapted accordingly in #95359.
Therefore the BUGFIX is reverted.

Resolves: #95358
Related: #95359
Reverts: #95327
Releases: master
Change-Id: I387fa2905b554ca12bf60d6bff452c9964c36a69

Tested-by: core-ci's avatarcore-ci <>
Tested-by: Helmut Hummel's avatarHelmut Hummel <>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <>
Reviewed-by: Helmut Hummel's avatarHelmut Hummel <>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <>
parent 6ff84cdd
......@@ -137,32 +137,18 @@ class Bootstrap
'boot.state' => $bootState,
// Push PackageManager instance to ExtensionManagementUtility to support ::isLoaded() checks in Services.php
// Note that ExtensionManagementUtility() usage in Services.php has never been an intended usage,
// but it was technically possible in TYPO3 v10 as a side effect of runtime activated packages,
// and therefore got documented in example code:
// Container builds should generally be stateless and should only take explicit service configuration and ContainerBuilder
// build-state into account. Therefore ExtensionManagementUtility usage in Services.php should generally be avoided,
// and be replaced by service checks, e.g. ContainerBuilder->hasDefinition(ClassNameOfOptionalDependency::class)
// (combined with package suggest definition in composer.json/ext_emconf.php to ensure extension ordering is correct)
// @todo: Adapt documentation and maybe log a deprecation notice if ::isLoaded() is used during container builds.
GeneralUtility::setSingletonInstance(PackageManager::class, $packageManager);
$container = $builder->createDependencyInjectionContainer($packageManager, $dependencyInjectionContainerCache, $failsafe);
// Push the container to GeneralUtility as we want to make sure its
// makeInstance() method creates classes using the container from now on.
// Reset singleton instances in order for GeneralUtility::makeInstance() to use
// ContainerInterface->get() for early services from now on.
// Reset LogManager singleton instance in order for GeneralUtility::makeInstance()
// to proxy LogManager retrieval to ContainerInterface->get() from now on.
GeneralUtility::removeSingletonInstance(LogManager::class, $logManager);
GeneralUtility::removeSingletonInstance(PackageManager::class, $packageManager);
// Push PackageManager instance to ExtensionManagementUtility
if ($failsafe) {
$bootState->done = true;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment