Skip to content

Commit e0f0211

Browse files
committed
Issue #3032869 by alexpott, tim.plunkett, dww, tacituseu, xjm, Mixologic: \Drupal\Core\Update\UpdateKernel::fixSerializedExtensionObjects() caused test runs to double in duration
1 parent c784c6a commit e0f0211

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

lib/Drupal/Core/Update/UpdateKernel.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,18 @@ public static function fixSerializedExtensionObjects(ContainerInterface $contain
218218
// created by Drupal <= 8.6.7 then when it is read by Drupal >= 8.6.8 there
219219
// will be PHP warnings. This silently fixes Drupal so that the update can
220220
// continue.
221-
$callable = function () use ($container) {
221+
$clear_caches = FALSE;
222+
$callable = function ($errno, $errstr) use ($container, &$clear_caches) {
223+
if ($errstr === 'Class Drupal\Core\Extension\Extension has no unserializer') {
224+
$clear_caches = TRUE;
225+
}
226+
};
227+
228+
set_error_handler($callable, E_ERROR | E_WARNING);
229+
$container->get('state')->get('system.theme.data', []);
230+
restore_error_handler();
231+
232+
if ($clear_caches) {
222233
// Reset static caches in profile list so the module list is rebuilt
223234
// correctly.
224235
$container->get('extension.list.profile')->reset();
@@ -227,11 +238,7 @@ public static function fixSerializedExtensionObjects(ContainerInterface $contain
227238
}
228239
// Also rebuild themes because it uses state as cache.
229240
$container->get('theme_handler')->refreshInfo();
230-
};
231-
232-
set_error_handler($callable, E_ERROR | E_WARNING);
233-
$container->get('state')->get('system.theme.data', []);
234-
restore_error_handler();
241+
}
235242
}
236243

237244
}

0 commit comments

Comments
 (0)