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,
- create a subprofile
- setup an environment
- kick start the install in a browser
- 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.