diff --git a/core/lib/Drupal/Core/Extension/Extension.php b/core/lib/Drupal/Core/Extension/Extension.php index 3c765fe..60392e5 100644 --- a/core/lib/Drupal/Core/Extension/Extension.php +++ b/core/lib/Drupal/Core/Extension/Extension.php @@ -137,13 +137,19 @@ public function getExtensionFilename() { /** * Loads the main extension file, if any. * + * Drupal will not attempt to load the file if it is not found. + * * @return bool * TRUE if this extension has a main extension file, FALSE otherwise. */ public function load() { if ($this->filename) { - include_once $this->root . '/' . $this->getPath() . '/' . $this->filename; - return TRUE; + + $filepath = $this->root . '/' . $this->getPath() . '/' . $this->filename; + if (realpath($filepath)) { + include_once $this->root . '/' . $this->getPath() . '/' . $this->filename; + return TRUE; + } } return FALSE; } @@ -188,7 +194,10 @@ public function serialize() { */ public function unserialize($data) { $data = unserialize($data); - $this->root = $data['root']; + // If the root path does not exist, make an assumption that the extension + // root is in the current application root path. A database dump could have + // system-specific strings. + $this->root = realpath($data['root']) ? DRUPAL_ROOT : $data['root']; $this->type = $data['type']; $this->pathname = $data['pathname']; $this->filename = $data['filename']; diff --git a/core/modules/system/src/Tests/Update/UpdatePathTestBase.php b/core/modules/system/src/Tests/Update/UpdatePathTestBase.php index f91c901..1d052c3 100644 --- a/core/modules/system/src/Tests/Update/UpdatePathTestBase.php +++ b/core/modules/system/src/Tests/Update/UpdatePathTestBase.php @@ -176,6 +176,9 @@ protected function setUp() { // Restore the original Simpletest batch. $this->restoreBatch(); + // Rebuild and reset. + $this->rebuildAll(); + // Replace User 1 with the user created here. // @todo: do this without saving the user account. /** @var \Drupal\user\UserInterface $account */ @@ -252,7 +255,9 @@ protected function rebuildAll() { // We know the rebuild causes notices, so don't exit on failure. $die_on_fail = $this->dieOnFail; $this->dieOnFail = FALSE; - parent::rebuildAll(); + + // Load the container without refreshing cache. + $this->container = \Drupal::getContainer(); // Remove the notices we get due to the menu link rebuild prior to running // the system updates for the schema change.