Hi,

I git pull'd drupal 8 5 minutes ago, and I got this error PHP Fatal error: Call to a member function get() on a non-object in my logs.

Regards,

Comments

Boobaa’s picture

I can confirm this, and I have a stack trace as well:

[Sat Mar 22 11:38:38.536629 2014] [fcgid:warn] [pid 24737:tid 140352719599360] [client 127.0.0.1:51015] mod_fcgid: stderr: PHP Fatal error:  Call to a member function get() on a non-object in /home/boobaa/drupal/d8/core/lib/Drupal.php on line 275
[Sat Mar 22 11:38:38.536738 2014] [fcgid:warn] [pid 24737:tid 140352719599360] [client 127.0.0.1:51015] mod_fcgid: stderr: PHP Stack trace:
[Sat Mar 22 11:38:38.536754 2014] [fcgid:warn] [pid 24737:tid 140352719599360] [client 127.0.0.1:51015] mod_fcgid: stderr: PHP   1. _drupal_exception_handler() /home/boobaa/drupal/d8/core/includes/bootstrap.inc:0
[Sat Mar 22 11:38:38.536767 2014] [fcgid:warn] [pid 24737:tid 140352719599360] [client 127.0.0.1:51015] mod_fcgid: stderr: PHP   2. _drupal_log_error() /home/boobaa/drupal/d8/core/includes/bootstrap.inc:1554
[Sat Mar 22 11:38:38.536785 2014] [fcgid:warn] [pid 24737:tid 140352719599360] [client 127.0.0.1:51015] mod_fcgid: stderr: PHP   3. drupal_maintenance_theme() /home/boobaa/drupal/d8/core/includes/errors.inc:135
[Sat Mar 22 11:38:38.536798 2014] [fcgid:warn] [pid 24737:tid 140352719599360] [client 127.0.0.1:51015] mod_fcgid: stderr: PHP   4. _drupal_maintenance_theme() /home/boobaa/drupal/d8/core/includes/bootstrap.inc:1882
[Sat Mar 22 11:38:38.536811 2014] [fcgid:warn] [pid 24737:tid 140352719599360] [client 127.0.0.1:51015] mod_fcgid: stderr: PHP   5. Drupal::config() /home/boobaa/drupal/d8/core/includes/theme.maintenance.inc:57

These lines have been added to my apache's error.log right at the first screen of the installer, the language selector.

Kartagis’s picture

Issue summary: View changes
Boobaa’s picture

It looks like if the bootstrap can't find settings, then it goes down till \Drupal\Component\PhpStorage\PhpStorageFactory::get() which tries to build a $configuration array using drupal_get_hash_salt(), which in turn tries to use the not-yet-existing settings, so it throws a RuntimeException with message being "Missing $settings['hash_salt'] in settings.php." – of course it's missing, since it hasn't been created yet.

znerol’s picture

Disable the error handler and exception handler when you experience errors in an early bootstrap phase. They currently trigger errors on their own and by doing so will hide the underlying cause.

The error and exception handlers are set in core/includes/bootstrap.inc, lines in _drupal_bootstrap_configuration. Disable them by commenting out the following lines:

  // Set the Drupal custom error handler. (requires \Drupal::config())
  #set_error_handler('_drupal_error_handler');
  #set_exception_handler('_drupal_exception_handler');
tim.plunkett’s picture

Category: Bug report » Support request
Priority: Critical » Normal

Did you try rebuilding first? See core/rebuild.php or drush cr.

Kartagis’s picture

Okay,

I git pull'd drupal 8 a minute ago, and this is what I got when I did drush cr

[root@webciniz drupal-8]# time drush cr
PHP Fatal error:  Uncaught exception 'RuntimeException' with message 'Missing $settings['hash_salt'] in settings.php.' in /var/www/drupal-8/core/includes/bootstrap.inc:1497
Stack trace:
#0 /var/www/drupal-8/core/lib/Drupal/Component/PhpStorage/PhpStorageFactory.php(47): drupal_get_hash_salt()
#1 /var/www/drupal-8/core/includes/utility.inc(46): Drupal\Component\PhpStorage\PhpStorageFactory::get('service_contain...')
#2 /usr/local/bin/drush/commands/core/cache.drush.inc(238): drupal_rebuild()
#3 [internal function]: drush_cache_rebuild()
#4 /usr/local/bin/drush/includes/command.inc(362): call_user_func_array('drush_cache_reb...', Array)
#5 /usr/local/bin/drush/includes/command.inc(214): _drush_invoke_hooks(Array, Array)
#6 [internal function]: drush_command()
#7 /usr/local/bin/drush/includes/command.inc(182): call_user_func_array('drush_command', Array)
#8 /usr/local/bin/drush/drush.php(98): drush_dispatch(Array)
#9 /usr/local/bin/drush/drush.php(61): _drush_bootstrap_and_dispatch()
#10 /usr/local/bin/drush/drush.php(16): drush_ in /var/www/drupal-8/core/includes/bootstrap.inc on line 1497
Drush command terminated abnormally due to an unrecoverable error.       [error]
Error: Uncaught exception 'RuntimeException' with message 'Missing
$settings['hash_salt'] in settings.php.' in
/var/www/drupal-8/core/includes/bootstrap.inc:1497
Stack trace:
#0
/var/www/drupal-8/core/lib/Drupal/Component/PhpStorage/PhpStorageFactory.php(47):
drupal_get_hash_salt()
#1 /var/www/drupal-8/core/includes/utility.inc(46):
Drupal\Component\PhpStorage\PhpStorageFactory::get('service_contain...')
#2 /usr/local/bin/drush/commands/core/cache.drush.inc(238):
drupal_rebuild()
#3 [internal function]: drush_cache_rebuild()
#4 /usr/local/bin/drush/includes/command.inc(362):
call_user_func_array('drush_cache_reb...', Array)
#5 /usr/local/bin/drush/includes/command.inc(214):
_drush_invoke_hooks(Array, Array)
#6 [internal function]: drush_command()
#7 /usr/local/bin/drush/includes/command.inc(182):
call_user_func_array('drush_command', Array)
#8 /usr/local/bin/drush/drush.php(98): drush_dispatch(Array)
#9 /usr/local/bin/drush/drush.php(61): _drush_bootstrap_and_dispatch()
#10 /usr/local/bin/drush/drush.php(16): drush_ in
/var/www/drupal-8/core/includes/bootstrap.inc, line 1497

Regards,

tim.plunkett’s picture

This is the key:
PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Missing $settings['hash_salt'] in settings.php.' in /var/www/drupal-8/core/includes/bootstrap.inc:1497

Reinstall, and be sure to start with a fresh copy of settings.php

Kartagis’s picture

I have cp sites/default/default.settings.php sites/default/settings.php in my alias for pulling d8.

pkosenko’s picture

Component: configuration system » update.module

I got this same error when I tried updating an older Drupal 8 according to the protocol laid out in upgrade.txt, which is pretty much the Drupal 7 method. I wanted to test if upgrading rather than reinstalling would work. But maybe it is not related to upgrade at all?

However, a fresh installation worked fine. Just the upgrade attempt failed.

It may be that upgrade is just not on a critical path at the moment?

************
Upgrade attempt:

[28-Mar-2014 12:11:15 America/Los_Angeles] PHP Fatal error: Call to a member function get() on a non-object in . . \drupal8\core\lib\Drupal.php on line 275

GIT pulled Drupal 8 yesterday (3/27/2014) at about 8:45 p.m.

The only detectable change in the settings.php was

$drupal_hash_salt = '';

changed to

$settings['hash_salt'] = '';

So I moved that salt value over to the settings.php and added the database configuration items.

I set the free upgrade access setting.

Database was old.

Tried to access the site, got fatal error.

*****************
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP Fatal error: Call to a member function get() on a non-object in C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\lib\Drupal.php on line 275
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP Stack trace:
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 1. {main}() C:\Users\pkosenko\Documents\My Web Sites\drupal8\index.php:0
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 2. drupal_handle_request() C:\Users\pkosenko\Documents\My Web Sites\drupal8\index.php:15
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 3. Drupal\Core\DrupalKernel->boot() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\includes\bootstrap.inc:1455
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 4. Drupal\Core\DrupalKernel->initializeContainer() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\lib\Drupal\Core\DrupalKernel.php:177
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 5. Drupal\Core\DependencyInjection\Container->get() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\lib\Drupal\Core\DrupalKernel.php:417
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 6. Symfony\Component\DependencyInjection\Container->get() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\lib\Drupal\Core\DependencyInjection\Container.php:21
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 7. service_container_prod->getConfig_FactoryService() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\vendor\symfony\dependency-injection\Symfony\Component\DependencyInjection\Container.php:312
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 8. Drupal\Core\DependencyInjection\Container->get() C:\Users\pkosenko\Documents\My Web Sites\drupal8\sites\default\files\php\service_container\service_container_prod.php\ee4db37c805b53cf4742077273a172eb73b456ffe9176c517d4806dfced83e52.php:1260
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 9. Symfony\Component\DependencyInjection\Container->get() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\lib\Drupal\Core\DependencyInjection\Container.php:21
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 10. service_container_prod->getConfig_StorageService() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\vendor\symfony\dependency-injection\Symfony\Component\DependencyInjection\Container.php:312
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 11. Drupal\Core\DependencyInjection\Container->get() C:\Users\pkosenko\Documents\My Web Sites\drupal8\sites\default\files\php\service_container\service_container_prod.php\ee4db37c805b53cf4742077273a172eb73b456ffe9176c517d4806dfced83e52.php:1299
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 12. Symfony\Component\DependencyInjection\Container->get() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\lib\Drupal\Core\DependencyInjection\Container.php:21
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 13. service_container_prod->getCache_ConfigService() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\vendor\symfony\dependency-injection\Symfony\Component\DependencyInjection\Container.php:312
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 14. Drupal\Core\DependencyInjection\Container->get() C:\Users\pkosenko\Documents\My Web Sites\drupal8\sites\default\files\php\service_container\service_container_prod.php\ee4db37c805b53cf4742077273a172eb73b456ffe9176c517d4806dfced83e52.php:1048
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 15. Symfony\Component\DependencyInjection\Container->get() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\lib\Drupal\Core\DependencyInjection\Container.php:21
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 16. service_container_prod->getCacheFactoryService() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\vendor\symfony\dependency-injection\Symfony\Component\DependencyInjection\Container.php:312
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 17. Drupal\Core\Cache\CacheFactory->__construct() C:\Users\pkosenko\Documents\My Web Sites\drupal8\sites\default\files\php\service_container\service_container_prod.php\ee4db37c805b53cf4742077273a172eb73b456ffe9176c517d4806dfced83e52.php:1178
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 18. _drupal_error_handler() C:\Users\pkosenko\Documents\My Web Sites\drupal8\sites\default\files\php\service_container\service_container_prod.php\ee4db37c805b53cf4742077273a172eb73b456ffe9176c517d4806dfced83e52.php:32
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 19. _drupal_error_handler_real() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\includes\bootstrap.inc:1519
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 20. _drupal_log_error() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\includes\errors.inc:79
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 21. drupal_maintenance_theme() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\includes\errors.inc:135
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 22. _drupal_maintenance_theme() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\includes\bootstrap.inc:1865
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 23. Drupal::config() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\includes\theme.maintenance.inc:58
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP Fatal error: Call to a member function get() on a non-object in C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\lib\Drupal.php on line 275

Anonymous’s picture

I'm mentoring someone who is experiencing this issue on their first D8 install, we have reinstalled to no avail. We need to have the ability to drush so we can test the migration path.

The configuration is a Mac using MAMP and it produces an error that suggests looking at #1428638: Forcing 127.0.0.1 instead of localhost for drush, however, it does not look like there is a problem based on what I'm seeing in the /etc/hosts file.

Anonymous’s picture

We figured it out. If you run drush sql-cli against D7 it will give you an error something like "mysql not found" and it turns out that running "which mysql" in fact did not produce anything.

So we had to update the $PATH environment variable for the terminal. In this case we put it into .bash_profile, adding the following path:

/Applications/MAMP/Library/bin

Then after adding this to the path we closed the terminal and opened a new session, typed "env" to confirm that the item now appears in the path.

Another solution is to install Acquia Dev Desktop: http://drupal.org/dctdi

manasiv’s picture

Thanks Ryan. Your solution in #11 worked. mysql was missing from my path variable on windows 7.
I am using wamp, drush and git bash
Updating the path variable fixed the error.

wanflap’s picture

Hi Kartagis,
I have the same errors on my Ubuntu instance. How did you get yours fixed?

Kartagis’s picture

@wanflap, the error still stands on my CentOS VPS, however it doesn't stop you from installing.

Toche’s picture

Version: 8.0.x-dev » 8.0.0-beta1
Category: Support request » Bug report
Issue tags: +Amsterdam2014

I´m Using MAMP 2.1.1
PHP 5.4.4
drupal-8.0.0-beta1.tar.gz

I fill the following steps:
1. Select an installation profile
2. Database configuration

and then i get this Error in my browser:
"The connection was reset
The connection to the server was reset while the page was loading.

  • The site could be temporarily unavailable or too busy. Try again in a few moments.
  • If you are unable to load any pages, check your computer's network connection.
  • If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web."

php_error.LOG
[03-Oct-2014 11:19:38 UTC] PHP Fatal error: Call to a member function get() on a non-object in /Users/myself/Documents/drupal.sites/drupal8/core/lib/Drupal.php on line 566
[03-Oct-2014 11:19:38 UTC] PHP Stack trace:
[03-Oct-2014 11:19:38 UTC] PHP 1. _drupal_exception_handler() /Users/myself/Documents/drupal.sites/drupal8/core/includes/bootstrap.inc:0
[03-Oct-2014 11:19:38 UTC] PHP 2. _drupal_log_error() /Users/myself/Documents/drupal.sites/drupal8/core/includes/bootstrap.inc:1080
[03-Oct-2014 11:19:38 UTC] PHP 3. Drupal::theme() /Users/myself/Documents/drupal.sites/drupal8/core/includes/errors.inc:128

jelo’s picture

Running XAMPP on Windows results in the same error. D8 B1 does not install at all...

BarisW’s picture

Same here as #15, with D8 beta2.

BarisW’s picture

Version: 8.0.0-beta1 » 8.0.x-dev
Component: update.module » install system
Berdir’s picture

Status: Active » Postponed (maintainer needs more info)

See my notes in #2322269: Undefined method addDependencyTrait() Breaks VPS Install

As written there, this happens when an error happens very early. In this case it is an exception. You need to figure out what exception exactly by adding debug statements to _drupal_exception_handler(), like var_dump($e->getMessage()) and var_dump($e->getTraceAsString().

dcrocks’s picture

I have been seeing this error
[Mon Nov 03 20:02:21.491327 2014] [:error] [pid 4671] [client ::1:50210] PHP Fatal error: Call to a member function get() on a non-object in /Users/rocks/Sites/drupal8/core/lib/Drupal.php on line 566
for a very long time in D8, maybe a year or more. It happens very early in install, before the 1st install page is displayed, only shows up once, only in the apache error log, and seems to have no affect on the install. The last is why I have mostly ignored it. But since D8 is now in beta it is probably more important to clean this up. I tried your debug statements in #19 but this error doesn't seem to be going thru that code. If you can suggest someplace else to try to debug, I'll give it a try.

MrHaroldA’s picture

I just got this error on a fresh Drupal-8.0.0-beta3 install.

If you have just changed code (for example deployed a new module or moved an existing one) read http://drupal.org/documentation/rebuild
Fatal error: Call to a member function get() on a non-object in /home/harold/checkout/d8/core/lib/Drupal.php on line 566

I'll try to debug this, but the reason I installed D8 is that I don't understand anything in D8 ;)

askibinski’s picture

I got this when I pushed some site code (theme, custom modules) from dev to test, and imported my database from dev to test (beta 2).
I tried truncating all cache_ tables and clearing php files in files dir, but that didn't help.

update: Figured out my problem was caused by an empty salt string in $settings['hash_salt'] on my remote environment. (The salt is only generated on install). See also this drush issue on github.

13rac1’s picture

dcrocks’s picture

re: #23. Even though the issue summary hasn't changed, multiple problems with similar symptoms are being discussed here. That is why I created #2377631: Early Install error: PHP Fatal error: Call to a member function get() on a non-object and don't wish to close it.

13rac1’s picture

Seems like the other problems described in this issue have been dealt with. Can we close this issue?

dcrocks’s picture

Seems like https://github.com/drush-ops/drush/issues/1002 has solved the drush issues.

moshe weitzman’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)
znerol’s picture

This has been fixed in #2317913: Early error handling can result in fatal error (Call to a member function get() on a non-object). Given the obscurity of this problem, I expect that there are still a couple of duplicates in the queue.