Change record status: 
Project: 
Introduced in branch: 
8.x
Introduced in version: 
8.0
Description: 

In Drupal 7 drupal_get_profile() returned 'standard' if the 'install_profile' variable was not set.

This variable was changed to a setting in Drupal 8 so prior to this change drupal_get_profile() returned 'standard' if the 'install_profile' setting did not exist. Also the function was previously changed to return an empty string in the installer when no profile has been selected yet.

In the majority of cases this was inconsequential as the 'install_profile' setting is set by the installer in Drupal 8 just like the 'install_profile' variable was set by the installer in Drupal 7.

In some cases, however, the fallback meant that drupal_get_profile() would return 'standard' even though that semantically did not make sense, primarily:

  • In the very first step(s) of the installer, before an installation profile has been selected (Drupal 7 only)
  • In KernelTestBase tests: These tests run in a minimal environment which by design is not a full Drupal installation

Therefore this fallback was removed from drupal_get_profile(). It now returns NULL in the above-mentioned cases, when there is no active installation profile.

The fallback caused problems in the above mentioned test types as configuration from the standard profile could be installed.

Example code

// Allow an installation profile to provide a 'foo' library.
//
// Drupal 7
$path = drupal_get_path('profile', drupal_get_profile()) . '/libraries/foo';
//
// Drupal 8
if ($profile = drupal_get_profile()) {
  $path = drupal_get_path('profile', $profile) . '/libraries/foo';
}

Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done