PHP Fatal error: Call to a member function get() on a non-object
I have been seeing this error when installing D8.0 for more than a year now, but have ignored it because it doesn't seem to have any consequences.
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
But now that D8.0 is beta it should be looked at before D8.0 release. The error message appears in my web server's(apache) error log before the first install page is displayed. It has happened across different versions of my OS(OS X), PHP, and apache. I initially reported this in #2223575: PHP Fatal error: Call to a member function get() on a non-object, but that issue seems to have become a catchall for problems with similar symptoms.
The error is only displayed in the web servers error log and not in Drupal's logs. I have tried to get more info by adding some var_dump()'s in _drupal_exception_handler(), but this error doesn't seem to go thru that code. I'd welcome any debugging tips.
To reproduce:
Start install for D8.0
Look at your web server's error log when the 1st install page is displayed.
Comments
Comment #1
dcrocks commentedI turned on xdebug and got a stack trace:
Now to see what I can figure out.
Comment #2
13rac1 commentedI've got the same issue with Mint 17 and PHP 5.5:
Comment #3
13rac1 commentedDuplicate of: https://www.drupal.org/node/2223575
Comment #4
daffie commented@eosrei: I do not think that that is a duplicate. I think that it has to do with drush and #2328111: Replace most instances of the DRUPAL_ROOT constant with the app.root container parameter.
I can confirm that with drush I get the same error as you do.
But if you do a "Clear all caches" on the page "admin/config/development/performance". I get no error.
Maybe the problem is with drush.
Comment #5
13rac1 commented@daffie This is the same error message. I also get this error in the logs during installation. #2223575: PHP Fatal error: Call to a member function get() on a non-object covers both instances (install and drush) already. See comment #16: https://www.drupal.org/node/2223575#comment-8625917
If we are sure the issue is with drush, then this should be closed and re-opened in the drush issue queue on github. At this point, I don't believe it to be the case.
Comment #6
daffie commentedI just did a clean install of the head-branch. Deleted the files directory. Droped all database tables. And copied settings.php and services.yml. It is a clean install. Before today I never had this problem. And also the error: PHP Fatal error: "Call to a member function get() on a non-object in /var/www/drupal8/core/lib/Drupal.php on line 161".
@eosrei: If you go to the page "admin/config/development/performance" and click on "Clear all caches" what do you get?
Comment #7
dcrocks commentedI want to keep this issue to the one error case. I created it because #2223575: PHP Fatal error: Call to a member function get() on a non-object has been clouded with multiple error scenarios with the same symptom. This error is repeatable across different environments and has been around for a long time. It also consistently fails on the same call in drupal.php:
If #2223575: PHP Fatal error: Call to a member function get() on a non-object is changed to focus on this one error, then I will close this one as a duplicate. Until then I am only interested in this single error scenario.
Comment #8
13rac1 commented@dcrocks Yes, Ok, that other issue is a mess of separate issues.
@daffie When I click "Clear all caches" Drupal does nothing. It acts like I refreshed the page. D7 installs work fine.
Comment #9
daffie commentedI have updated drush and for me the problem is gone.
Comment #10
anavarreRight, this was fixed per https://github.com/drush-ops/drush/issues/1002
Comment #11
anavarreChanging status for now.
Comment #12
dcrocks commentedMy problem has nothing to do with drush. I can't seem to keep this conversation separate. However, the patch in #2363341: Throw exception in Drupal::service() and friends, if container not initialized yet. seems to fix my problem as well. If that goes final I'll close this as a duplicate.
Comment #13
anavarreApologies, I overlooked the issue summary.
Comment #14
jhedstromThis specific error:
PHP Fatal error: Call to a member function get() on a non-object in /var/www/drupal8/core/lib/Drupal.php on line 161was due to a bug in very early error handling, which has been fixed in #2317913: Early error handling can result in fatal error (Call to a member function get() on a non-object).
Comment #15
dcrocks commentedActually, I already tried #2317913: Early error handling can result in fatal error (Call to a member function get() on a non-object) and it doesn't fix my problem. But, as I alluded before, #2363341: Throw exception in Drupal::service() and friends, if container not initialized yet. does.
Comment #16
dcrocks commentedAdded related issue.
Comment #17
dcrocks commented#2363341: Throw exception in Drupal::service() and friends, if container not initialized yet. has been committed and swallows this error, so I am going to close this.
Comment #18
tim.plunkettI have no idea what error you think is happening during early install. Now that everything is centralized, you can even replace the thrown exception with
die;and it will still install properly.Comment #19
dcrocks commentedThe error is as described in the summary. A PHP fatal occurs early in install as shown in the Apache error log. It is not my error, it is drupal's. It has been there a long time over multiple OS's and machines and has no apparent affect. But it is there. Since it has no apparent impact it wouldn't be seen unless you look at the Apache error log. Now it won't be seen at all because the exception is caught, but not recorded. I see no point now of pursuing it but as far as I am concerned, it hasn't been fixed and it is still occurring.