When I go to the "Available updates" page in the admin section, I see a warning about "Undefined variable: profile" in the core system module:
docroot/core/modules/system/system.module
I expect this page and all other admin pages to load without triggering an error message from this module.
Looking at the code for the module, $profile is indeed undefined, so this module will always trip up and throw the warning.
My system specs:
Model Name: MacBook Pro
Model Identifier: MacBookPro11,2
Processor Name: Intel Core i7
Processor Speed: 2.2 GHz
Memory: 16 GB
My local environment:
Drush was attempting to connect to:
Drupal version : 8.4.4
Site URI : http://default
Database driver : mysql
Database hostname : 127.0.0.1
Database port : 3306
Database username : drupal
Database name : drupal
PHP configuration : /etc/php/7.1/cli/php.ini
PHP OS : Linux
Drush script : /usr/local/bin/drush
Drush version : 8.1.14
Drush temp directory : /tmp
Drush configuration :
Drush alias files : /root/.drush/drupalvm.aliases.drushrc.php
/var/www/drupalvm/drupal/web/docroot/../drush/site-aliases/mysite.sites.aliases.drushrc.p
hp /var/www/drupalvm/drupal/web/docroot/../drush/site-aliases/mysite.aliases.drushrc.php
/var/www/drupalvm/drupal/web/docroot/../drush/site-aliases/aliases.drushrc.php
Drupal root : /var/www/drupalvm/drupal/web/docroot
Drupal Settings File : sites/default/settings.php
Site path : sites/default
Sync config path : ../config/default
</code
Copy of error message:
<code>
Notice: Undefined variable: profile in _system_rebuild_module_data() (line 1054 of core/modules/system/system.module).
_system_rebuild_module_data() (Line: 1102)
system_rebuild_module_data() (Line: 132)
Drupal\update\UpdateManager->getProjects() (Line: 366)
update_get_available() (Line: 33)
update_requirements('runtime')
call_user_func_array('update_requirements', Array) (Line: 402)
Drupal\Core\Extension\ModuleHandler->invokeAll('requirements', Array) (Line: 112)
Drupal\system\SystemManager->listRequirements() (Line: 49)
Drupal\system\Controller\SystemInfoController->status()
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 153)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 67)
Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 38)
Drupal\jsonapi\StackMiddleware\FormatSetter->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 657)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Comments
Comment #2
cilefen commentedWhat is the history of this site? Was it installed with the standard profile? Have there been configuration imports? The reason is that this site hasn't got 'profile' set in the 'core.extension' configuration.
Comment #3
gabe.connolly commentedThis site was built from a custom installation profile based on Lightning. In core.extension, a profile value is set, so I don't believe that is the issue.
In the module source code, this is where the error is coming from:
$profileis not declared anywhere before it is called in the script block above, so it will always return a PHP warning. I do not know if the logic block that is causing the error is vestigial code that was meant to be removed, or if $profile was simply meant to be declared earlier but was omitted as an oversight.Comment #4
cilefen commented@gabe.connolly Hmmm... I am not sure what you mean by $profile being undeclared, or maybe I am just misunderstanding, when in _system_rebuild_module_data():
$profile = drupal_get_profile()The block of code you posted is not the source of the notice, but a similar one higher up in _system_rebuild_module_data().
When I traced this last week it seems module should be set in core.extension. Have you exported the core.extension configuration and are sure that 'profile' is set?
See also default.settings.php in the documentation near
$settings['install_profile'].Comment #5
gabe.connolly commented@cilefen, I think I'm getting closer to the root cause here, but that's proving to be even more confusing.
$profile = drupal_get_profile()just simply isn't anywhere in my system.module file. Comparing my source code to the 8.4.x branch on http://cgit.drupalcode.org, I'm seeing a number of differences between what's there any my local code. I'm using composer to manager core and modules for my project, so I'm confused as to how I would be getting out of date or inaccurate code. I'm going to keep digging into this and see if there's a composer dependency conflict somewhere, or if the problem is coming from elsewhere.Comment #6
cilefen commentedIt's in bootstrap.inc.
Comment #7
gabe.connolly commentedAfter more troubleshooting, I believe this issue was the result of problems applying composer patches during a Drupal Core / Acquia Lightning update. After sorting that out, this problem appears to be resolved, so I am closing out this issue.
Comment #8
plato1123 commentedAny additional insights on what exactly you had to do to knock out this error? I'm seeing the same error after upgrading lightning from 2.17 to 2.20 (Drupal 8.4.8) and am also using Bootstrap. Thanks for any info you can provide!