From 991e1433dfd3295645141a21b26d5183ed255d02 Mon Sep 17 00:00:00 2001
From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org>
Date: Fri, 30 Oct 2015 17:41:12 +0000
Subject: [PATCH] Issue #2603152 by alexpott, Fabianx, neclimdul: Fix PHP 7
 testbot failures

---
 core/lib/Drupal/Core/DrupalKernel.php | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index 0c16cb35cc11..fdb3d86885e6 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -821,6 +821,13 @@ protected function initializeContainer() {
     // If there is no container and no cached container definition, build a new
     // one from scratch.
     if (!isset($container) && !isset($container_definition)) {
+      if (version_compare(phpversion(), '7.0.0-dev') >= 0) {
+        // The service graph implementation is prone to corruption during GC.
+        // Collect cycles now then disable the GC for the time of the compiler
+        // run.
+        // @see https://bugs.php.net/bug.php?id=70805
+        gc_collect_cycles();
+      }
       $container = $this->compileContainer();
 
       // Only dump the container if dumping is allowed. This is useful for
-- 
GitLab