$language variable causes a lot of notices as non-object

by lacko21   Last Updated January 13, 2018 07:07 AM

I get a lot of notices on my site.

f.e. Notice: Trying to get property of non-object in drupal_lookup_path() (line 77 of /home/srv/www/mysite/includes/path.inc).

Notice: Trying to get property of non-object in template_preprocess_html() (line 2497 of /home/srv/www/mysite/includes/theme.inc).

and many other. And also warning: Warning: Attempt to assign property of non-object in template_preprocess_html() (line 2497 of /home/srv/www/mysite/includes/theme.inc).

I don't know how to fix this. Thanks to all for help.

Tags : i18n-l10n

Answers 2

For your issues you can refer

these links have given some patch for these notices

  1. https://www.drupal.org/node/1907684

  2. https://www.drupal.org/node/1104822

  3. https://www.drupal.org/node/1853170

February 20, 2015 15:50 PM

I'm assuming you are using Features on a multilingual website.

Using "Variable translation" to have a multilingual slogan, and using Features to export the slogan, the language_default is saved as an array, instead of an object.

How to fix:

$language_default = variable_get('language_default', array());
variable_set('language_default', (object) $language_default);

Execute the code above in Drupal cron or somewhere in Drupal. It converts $language_default array to object.

Source is here.

Sherzod Shermukhamedov
Sherzod Shermukhamedov
January 13, 2018 06:47 AM

Related Questions

Keep node/user tabs in one language

Updated May 16, 2016 08:03 AM

How do I include a custom module translation?

Updated June 28, 2016 08:03 AM

Adding an existing node as a translation

Updated August 09, 2016 08:03 AM

Drupal 8: make Taxonomy terms translatable

Updated August 16, 2016 08:04 AM

How to show 404 page for nodes without translation?

Updated September 01, 2016 08:04 AM