I'm using GIT and was previously at 8.0.0-beta1, I then merged 8.0.0-beta2, ran update.php, but now I'm getting the following error:

Fatal error: Call to a member function getPath() on a non-object in /vagrant/drupal8/core/lib/Drupal/Core/Theme/ThemeInitialization.php on line 163
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP Stack trace:
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 1. {main}() /vagrant/drupal8/index.php:0
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 2. Drupal\\Core\\DrupalKernel->handle() /vagrant/drupal8/index.php:22
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 3. Stack\\StackedHttpKernel->handle() /vagrant/drupal8/core/lib/Drupal/Core/DrupalKernel.php:563
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 4. Drupal\\Core\\StackMiddleware\\ReverseProxyMiddleware->handle() /vagrant/drupal8/core/vendor/stack/builder/src/Stack/StackedHttpKernel.php:23
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 5. Drupal\\Core\\StackMiddleware\\PageCache->handle() /vagrant/drupal8/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php:58
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 6. Drupal\\Core\\StackMiddleware\\KernelPreHandle->handle() /vagrant/drupal8/core/lib/Drupal/Core/StackMiddleware/PageCache.php:52
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 7. Symfony\\Component\\HttpKernel\\HttpKernel->handle() /vagrant/drupal8/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php:53
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 8. Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw() /vagrant/drupal8/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php:66
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 9. call_user_func_array:{/vagrant/drupal8/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php:145}() /vagrant/drupal8/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php:145
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 10. Drupal\\Core\\Controller\\HtmlPageController->content() /vagrant/drupal8/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php:145
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 11. Drupal\\Core\\Controller\\HtmlControllerBase->createHtmlFragment() /vagrant/drupal8/core/lib/Drupal/Core/Controller/HtmlPageController.php:54
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 12. Drupal\\Core\\Page\\RenderHtmlRenderer->render() /vagrant/drupal8/core/lib/Drupal/Core/Controller/HtmlControllerBase.php:70
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 13. Drupal\\Core\\Page\\RenderHtmlRenderer->drupalRender() /vagrant/drupal8/core/lib/Drupal/Core/Page/RenderHtmlRenderer.php:42
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 14. drupal_render() /vagrant/drupal8/core/lib/Drupal/Core/Page/RenderHtmlRenderer.php:86
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 15. call_user_func:{/vagrant/drupal8/core/includes/common.inc:2766}() /vagrant/drupal8/core/includes/common.inc:2766
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 16. Drupal\\views\\Element\\View::preRenderViewElement() /vagrant/drupal8/core/includes/common.inc:2766
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 17. Drupal\\views\\ViewExecutable->executeDisplay() /vagrant/drupal8/core/modules/views/src/Element/View.php:63
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 18. Drupal\\views\\Plugin\\views\\display\\Page->execute() /vagrant/drupal8/core/modules/views/src/ViewExecutable.php:1448
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 19. Drupal\\views\\ViewExecutable->render() /vagrant/drupal8/core/modules/views/src/Plugin/views/display/Page.php:95
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 20. Drupal\\Core\\Theme\\ThemeManager->getActiveTheme() /vagrant/drupal8/core/modules/views/src/ViewExecutable.php:1305
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 21. Drupal\\Core\\Theme\\ThemeManager->initTheme() /vagrant/drupal8/core/lib/Drupal/Core/Theme/ThemeManager.php:81
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 22. Drupal\\Core\\Theme\\ThemeInitialization->initTheme() /vagrant/drupal8/core/lib/Drupal/Core/Theme/ThemeManager.php:128
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 23. Drupal\\Core\\Theme\\ThemeInitialization->getActiveThemeByName() /vagrant/drupal8/core/lib/Drupal/Core/Theme/ThemeInitialization.php:51
[Mon Oct 20 12:13:26 2014] [error] [client 10.0.2.2] PHP 24. Drupal\\Core\\Theme\\ThemeInitialization->getActiveTheme() /vagrant/drupal8/core/lib/Drupal/Core/Theme/ThemeInitialization.php:95

Comments

axle_foley00’s picture

Component: database update system » theme system
rvolk’s picture

Same for me, either front nor backend theme is available: WOD
My page is hosted on devcloud.acquia-sites.com, this may be interesting for the environment / caching.

I've spend some time analyzing the problem, here are some results:

0. The function receives an empty array
1. clearing the caches manually makes no difference
2. the cache_bootstrap 'system_list' is filled automatically with both active themes afterwards (bartik & seven)
3. rebuilding the sites/default/files/php directory has no effect
4. the /core/rebuild.php script has no effect
5. switching back to 8.0.0-beta1 resolves the problem, switching to 8.0.x has the same problem like 8.0.0-beta2

so far..

rvolk’s picture

empty array means:

Array
(
    [0] => 
)
rvolk’s picture

Version: 8.0.0-beta2 » 8.0.x-dev
Status: Active » Needs review
StatusFileSize
new723 bytes

Too easy... swapped lines! How could i miss that, patch attached!

Needs review!

Status: Needs review » Needs work

The last submitted patch, 4: ThemeInitialization.patch, failed testing.

rvolk’s picture

StatusFileSize
new691 bytes
rvolk’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 6: ThemeInitialization.patch, failed testing.

rvolk’s picture

Priority: Normal » Major
Status: Needs work » Needs review
Issue tags: +Classy, +dependency, +theme
StatusFileSize
new706 bytes

Tests failed, so i dug a little deeper and found out that the seven theme depend on classy. But classy was not active in my previous beta1 configuration.

The $themes array in the getActiveThemeByName() function contained only the active themes bartik and seven. When the function tried to allocate the ancestor theme, found in the base_theme attribute of seven, it failed because the following code didn't cover this case:

$base_themes[] = $themes[$ancestor];

Of course we could simply wrap that line into an additional isset() condition, but i don't know if only active themes or all ancestor themes like in the comment above should be collected.

A review of a core theme developer is necessary!

For all others with this bug: Please activate the classy theme with the 8.0.0-beta1 branch before you upgrade your core to a newer version!

axle_foley00’s picture

Thanks. Your patch in #9 helped.

dawehner’s picture

@R. Volk
Your bugfix seems to be a valid way to fix it, but it would be cool to actually understand what is going on here.
So you write that classy is not enabled but your theme requires it? In case this is the main reason here,
we might should thrown an exception instead explaining people that this is the thing which is wrong. This is
the only proper way to find those kind of bugs instead of hiding it.

rvolk’s picture

@dawehner
Sure thing, the patch does only help to recover the page! I would prefer an exception as well, but we should find out if installation of the ancestor theme is required first! As far as I understand shouldn't be the installation necessary at all. From a user perspective, I would only install one frontend theme, why should I install the ancestors? This mechanic should be covered by the core. Maybe it's necessary to load even the not installed theme information at this point. So this is a question about the architecture and this bug seems to be only the tip of the ice berg.

That's why I like to have a review of this behavior from one of the core theme developers.

yukare’s picture

Just one question: this was not because an update from beta1 to beta2? This is not suported now and may break a site in some stange ways. If you updated the site from one beta to another, you have to reinstall drupal.

rvolk’s picture

Yes, the problem was only identified through the change from beta1 to beta2, but it's a general question and will come back when people start writing themes depending on each other.

scothar’s picture

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 72 bytes) in /core/lib/Drupal/Core/Theme/ThemeInitialization.php on line 92

I just triggered this while working with a stand-alone twig theme using 8.0.0-beta2.

dawehner’s picture

In case we check it we might should throw an exception because the failure seems to be a miss-written theme ...

Aki Tendo’s picture

In case we check it we might should throw an exception because the failure seems to be a miss-written theme ...

Not an exception - if the theme has a correct configuration this can never happen. This is a job for assert.

dawehner’s picture

Not an exception - if the theme has a correct configuration this can never happen. This is a job for assert.

Well fair, if we start to use asserts we should indeed have a look at converting a lot of the existing exceptions into assertions.

jhedstrom’s picture

Patch still applies here, but I'm not sure this is still an issue or not?

Aki Tendo’s picture

As long as the dependency injector attaches the URL Generator in a separate step from construction the Twig Extension object can be left in an invalid state so yes, attaching the assertions is still necessary, though it's covered by a different ticket.

jhedstrom’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update

Can somebody update the IS and describe the new approach? The current patch does not use assertions, so setting to needs work.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

xjm’s picture

Status: Needs work » Postponed (maintainer needs more info)
Issue tags: +Needs steps to reproduce

Implementing assertions is out of scope I think (thanks for #2444003: Optimize Drupal\Core\Template\Attribute). What we need to know if this is even still reproducible with supported core versions. What are steps to reproduce this bug with a stable release? If there are none, we can close the issue and instead just work on making the theme system's error reporting more useful.

joachim’s picture

I'm seeing this with an install profile that doesn't have a dependencies: property defined in its info.yml.

xjm’s picture

Thanks @joachim. Is it the exact error in the summary though (with that full backtrace) or just the error in the title? Does the profile have a themes key?

Technically I guess a profile could have no dependencies, but if it's a matter of the profile not declaring dependencies (but still using the code from them) then that would be a bug with the profile. I don't know if it'd be possible to improve the error handling for the latter case (see the discussion above about assertions), but that'd be a normal task if so.

xjm’s picture

xjm’s picture

Beau Townsend’s picture

Issue tags: +neworleans2016

Looking at this issue.

Beau Townsend’s picture

Breaking for lunch. Unsure exactly how to reproduce, but will look into it and attempt to document upon my return.

Beau Townsend’s picture

This issue appears to be outside of my expertise. No longer examining how to duplicate error.

xjm’s picture

Thanks @Beau Townsend for looking into it!

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

joelpittet’s picture

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

Since we haven't got clear steps to reproduce and it may have been fixed in #2608408: Call to a member function getPath() when installing Profiles with unknown modules as requirement I'm closing this as out-dated. Feel free to re-open if some steps can be be provided.