aboutsummaryrefslogtreecommitdiffstats
path: root/includes/services
diff options
context:
space:
mode:
Diffstat (limited to 'includes/services')
-rw-r--r--includes/services/ServiceContainer.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/includes/services/ServiceContainer.php b/includes/services/ServiceContainer.php
index 30f82955c53b..d934d270e44b 100644
--- a/includes/services/ServiceContainer.php
+++ b/includes/services/ServiceContainer.php
@@ -100,6 +100,12 @@ class ServiceContainer implements DestructibleService {
}
}
+ // Break circular references due to the $this reference in closures, by
+ // erasing the instantiator array. This allows the ServiceContainer to
+ // be deleted when it goes out of scope.
+ $this->serviceInstantiators = [];
+ // Also remove the services themselves, to avoid confusion.
+ $this->services = [];
$this->destroyed = true;
}