diff -u b/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php --- b/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php @@ -113,7 +113,12 @@ // Get the active install profile from the site's configuration. $current_core_extension = $config_importer->getStorageComparer()->getTargetStorage()->read('core.extension'); - $install_profile = isset($current_core_extension['profile']) ? $current_core_extension['profile'] : NULL; + if (isset($current_core_extension['profile'])) { + // Ensure the active profile is not changing. + if ($current_core_extension['profile'] !== $core_extension['profile']) { + $config_importer->logError($this->t('Cannot change the install profile from %new_profile to %profile once Drupal is installed.', ['%profile' => $install_profile, '%new_profile' => $core_extension['profile']])); + } + } // Get a list of installed profiles. $installed_profiles = \Drupal::service('profile_handler')->getProfiles(); @@ -144,9 +149,4 @@ $config_importer->logError($message); } - - // Ensure the active profile is not changing. - if ($install_profile !== $core_extension['profile']) { - $config_importer->logError($this->t('Cannot change the install profile from %new_profile to %profile once Drupal is installed.', ['%profile' => $install_profile, '%new_profile' => $core_extension['profile']])); - } }