Description

When running database updates via drupal console the following notice occurs:

Notice: Undefined variable: profile in /var/www/drupal/docroot/core/modules/system/system.module on line 1054

How to reproduce

drupal update:execute

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

stefanos.petrakis created an issue. See original summary.

stefanos.petrakis@gmail.com’s picture

Status: Active » Needs review
FileSize
536 bytes

And a patch for this.

borisson_’s picture

Are we sure we need to fix this in core? Shouldn't this be fixed in drupal console?

stefanos.petrakis@gmail.com’s picture

This is a core issue IMO, since the _system_rebuild_module_data() function (https://github.com/drupal/drupal/blob/8.5.x/core/modules/system/system.m...) is not instantiating an expected variable as it should.

However, it looks that this was deprecated in 8.5.0 (missed that part) and is therefore fixed (https://www.drupal.org/node/2709919).

borisson_’s picture

Does #4 mean that we can close this issue?

stefanos.petrakis@gmail.com’s picture

Version: 8.5.x-dev » 8.4.x-dev

It is still relevant for 8.4.x, therefore, IMO still an open issue. (till 8.4.x reaches end of life).

stefanos.petrakis@gmail.com’s picture

Version: 8.4.x-dev » 8.5.x-dev

Correction, still relevant for both 8.5.x and 8.4.x (checked the codes of latest dev versions)

cilefen’s picture

Because I keep hearing things like #6, I would like to call attention to the release cycle overview. Under current policy, the prior minor release is end-of-life on the day a new minor is released. But note:

There will be a minimum of 1 month between the release of a new minor and public disclosure of any security issues that affect the previous minor, in order to ensure all sites have adequate time to upgrade.

stefanos.petrakis@gmail.com’s picture

Correction to #6: 8.4.x has reached end of life. The submitted patch still applies to 8.4.x

This issue will remain relevant till the end-of-life of 8.5.x (September 5, 2018).

joachim’s picture

Status: Needs review » Postponed (maintainer needs more info)

> This is a core issue IMO, since the _system_rebuild_module_data() function (https://github.com/drupal/drupal/blob/8.5.x/core/modules/system/system.m...) is not instantiating an expected variable as it should.

Has this maybe already been fixed?

I've looked at both 8.5.x and 8.4.x, and in both cases, _system_rebuild_module_data() has this right near the top, about 5 lines in:

 $profile = drupal_get_profile();
cilefen’s picture

@joachim: In 8.6.x, _system_rebuild_module_data() was deprecated and replaced with a call to \Drupal::service('extension.list.module')->reset()->getList() in #2208429: Extension System, Part III: ExtensionList, ModuleExtensionList and ProfileExtensionList.

joachim’s picture

Sure, but in 8.4.x and 8.5.x, I can't see the problem that this issue is about.

cilefen’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

@joachim I totally agree. $profile is already set to something in that function before this occurs, so of course it is defined in scope.

To be sure, I just executed all the updates from 8.4.x to 8.5.x and there is not a notice.

$ vendor/bin/drupal update:execute
 Switch site into maintenance mode
 Executing required previous updates
 Executing update function "8501" of module "system"
 Executing update function "8400" of module "block_content"
 Executing update function "8500" of module "field"
 Executing update function "8500" of module "views"
 Executing update function "change_action_plugins" of module "system"
 Executing update function "field_formatter_entity_schema" of module "system"
 Executing update function "bulk_field_moved" of module "views"
 Executing update function "entity_link_url" of module "views"
 Executing update function "filter_placeholder_text" of module "views"
 Executing update function "table_display_cache_max_age" of module "views"
 Executing update function "views_data_table_dependencies" of module "views"
 Operating in maintenance mode off

 // update:entities
 Operating in maintenance mode on
 Starting the entity updates
 Finished the entity updates
 Operating in maintenance mode off
 // cache:rebuild

 Rebuilding cache(s), wait a moment please.


 [OK] Done clearing cache(s).

If we can get steps to reproduce this, let's reopen it. But since this function is deprecated, we shouldn't spend too much effort on it.

Thanks all!