diff --git a/core/modules/system/src/Tests/Update/UpdatePathTestBaseTest.php b/core/modules/system/src/Tests/Update/UpdatePathTestBaseTest.php index 70e250a..ded77aa 100644 --- a/core/modules/system/src/Tests/Update/UpdatePathTestBaseTest.php +++ b/core/modules/system/src/Tests/Update/UpdatePathTestBaseTest.php @@ -38,6 +38,25 @@ public function testDatabaseLoaded() { foreach (['user', 'node', 'system', 'update_test_schema'] as $module) { $this->assertEqual(drupal_get_installed_schema_version($module), 8000, SafeMarkup::format('Module @module schema is 8000', ['@module' => $module])); } + + // Ensure that all {router} entries can be unserialized. If they cannot be + // unserialized a notice will be thrown by PHP. + + $result = \Drupal::database()->query("SELECT name, route from {router}")->fetchAllKeyed(0, 1); + // For the purpose of fetching the notices and displaying more helpful error + // messages, let's override the error handler temporarily. + set_error_handler(function ($severity, $message, $filename, $lineno) { + throw new \ErrorException($message, 0, $severity, $filename, $lineno); + }); + foreach ($result as $route_name => $route) { + try { + unserialize($route); + } + catch (\Exception $e) { + $this->fail(sprintf('Error "%s" while unserializing route %s', $e->getMessage(), $route_name)); + } + } + // Before accessing the site we need to run updates first or the site might // be broken. $this->runUpdates();