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
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | ThemeInitialization.patch | 706 bytes | rvolk |
Comments
Comment #1
axle_foley00 commentedComment #2
rvolkSame 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..
Comment #3
rvolkempty array means:
Comment #4
rvolkToo easy... swapped lines! How could i miss that, patch attached!
Needs review!
Comment #6
rvolkComment #7
rvolkComment #9
rvolkTests 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:
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!
Comment #10
axle_foley00 commentedThanks. Your patch in #9 helped.
Comment #11
dawehner@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.
Comment #12
rvolk@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.
Comment #13
yukare commentedJust 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.
Comment #14
rvolkYes, 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.
Comment #15
scothar commentedFatal 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.
Comment #16
dawehnerIn case we check it we might should throw an exception because the failure seems to be a miss-written theme ...
Comment #17
Aki Tendo commentedNot an exception - if the theme has a correct configuration this can never happen. This is a job for assert.
Comment #18
dawehnerWell fair, if we start to use asserts we should indeed have a look at converting a lot of the existing exceptions into assertions.
Comment #19
jhedstromPatch still applies here, but I'm not sure this is still an issue or not?
Comment #20
Aki Tendo commentedAs 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.
Comment #21
jhedstromCan somebody update the IS and describe the new approach? The current patch does not use assertions, so setting to needs work.
Comment #23
xjmImplementing 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.
Comment #24
joachim commentedI'm seeing this with an install profile that doesn't have a dependencies: property defined in its info.yml.
Comment #25
xjmThanks @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.
Comment #26
xjmAdding a related issue from #2715961: 'drush si' crashes with a site that's been set up with Config installer.
Comment #27
xjmComment #28
Beau Townsend commentedLooking at this issue.
Comment #29
Beau Townsend commentedBreaking for lunch. Unsure exactly how to reproduce, but will look into it and attempt to document upon my return.
Comment #30
Beau Townsend commentedThis issue appears to be outside of my expertise. No longer examining how to duplicate error.
Comment #31
xjmThanks @Beau Townsend for looking into it!
Comment #32
malcomio commentedPossibly related to #2608408: Call to a member function getPath() when installing Profiles with unknown modules as requirement
Comment #34
joelpittetSince 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.