From f633f3b1080d37097b2a184d5442d571331d30a9 Mon Sep 17 00:00:00 2001 From: xjm Date: Thu, 14 Feb 2019 12:07:07 -0600 Subject: [PATCH] Issue #3032869 by alexpott, tim.plunkett, dww, tacituseu, Mixologic: \Drupal\Core\Update\UpdateKernel::fixSerializedExtensionObjects() caused test runs to double in duration --- core/lib/Drupal/Core/Update/UpdateKernel.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/core/lib/Drupal/Core/Update/UpdateKernel.php b/core/lib/Drupal/Core/Update/UpdateKernel.php index d5051a7916c..1b993b4061e 100644 --- a/core/lib/Drupal/Core/Update/UpdateKernel.php +++ b/core/lib/Drupal/Core/Update/UpdateKernel.php @@ -218,7 +218,18 @@ class UpdateKernel extends DrupalKernel { // created by Drupal <= 8.6.7 then when it is read by Drupal >= 8.6.8 there // will be PHP warnings. This silently fixes Drupal so that the update can // continue. - $callable = function () use ($container) { + $clear_caches = FALSE; + $callable = function ($errno, $errstr) use ($container, &$clear_caches) { + if ($errstr === 'Class Drupal\Core\Extension\Extension has no unserializer') { + $clear_caches = TRUE; + } + }; + + set_error_handler($callable, E_ERROR | E_WARNING); + $container->get('state')->get('system.theme.data', []); + restore_error_handler(); + + if ($clear_caches) { // Reset static caches in profile list so the module list is rebuilt // correctly. $container->get('extension.list.profile')->reset(); @@ -227,11 +238,7 @@ class UpdateKernel extends DrupalKernel { } // Also rebuild themes because it uses state as cache. $container->get('theme_handler')->refreshInfo(); - }; - - set_error_handler($callable, E_ERROR | E_WARNING); - $container->get('state')->get('system.theme.data', []); - restore_error_handler(); + } } }