SubProfile of WxT when installing from browser has a null value

Created on 19 June 2023, over 1 year ago
Updated 26 June 2023, over 1 year ago

Problem/Motivation

After sub-profiling the WxT and attempting to install the new profile via browser, an error is thrown to the screen:

Error
The website encountered an unexpected error. Please try again later.
Drupal\Core\Extension\Exception\UnknownExtensionException: The profile does not exist. in Drupal\Core\Extension\ExtensionList->get() (line 265 of core/lib/Drupal/Core/Extension/ExtensionList.php).
Drupal\Core\Extension\ExtensionList->get(NULL) (Line: 35)
wxt_core_requirements('install') (Line: 992)
drupal_check_profile('innova_profile') (Line: 2096)
install_check_requirements(Array) (Line: 1095)
install_verify_requirements(Array) (Line: 707)
install_run_task(Array, Array) (Line: 578)
install_run_tasks(Array, NULL) (Line: 120)
install_drupal(Object) (Line: 48)

Steps to reproduce

The steps to reproduce are quite simple,

  1. create a subprofile
  2. setup an environment
  3. kick start the install in a browser
  4. get the error

Proposed resolution

I think the following condition check resolves this. Patch will follow.

Here is what I think the problem is:

In Drupal, this method returns string or null.

  /**
   * Gets the active install profile.
   *
   * @return string|null
   *   The name of the active install profile.
   */
  public static function installProfile() {
    return static::getContainer()->getParameter('install_profile');
  }

The problem is that a null passed to this service call: Drupal::service('extension.list.profile')->get($profile) throws an exception and then we're dead in the water. Instead, we should be wrapping the result in a conditional check.

🐛 Bug report
Status

Fixed

Version

5.0

Component

Code

Created by

🇨🇦Canada wilco

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024