Fatal error: Cannot use object of type stdClass as array in www/includes/theme.inc on line 813

Comments

emilkarl’s picture

I get the same error, it only occurs if I have languageicons module installed as well. Looking for solution...

emilkarl’s picture

StatusFileSize
new596 bytes

Fix for language icons problem.

emilkarl’s picture

StatusFileSize
new760 bytes

Updated the code a bit to remove notices.

juves’s picture

Front: Fatal error: Unsupported operand types in /www/includes/form.inc on line 1681
Admin: Notice: Array to string conversion in form_builder() (Line 1768 in /iwww/includes/form.inc).

--------------------------------------------

This lines

  if (module_exists('languageicons')) {
    $form['lang_dropdown_select'][$flag_position] = $language_icon;
  }

should be changed to

  if (module_exists('languageicons') && $settings['js_widget']) {
    $form['lang_dropdown_select'][$flag_position] = $language_icon;
  }

because $flag_position is only defined if js-widget is enabled

juves’s picture

I have applied your patch and changed this

    // Handle flags with Language icons module using JS widget
    if (module_exists('languageicons') && $settings['js_widget']) {
      $language_icon = '';
      $icons_path = variable_get('languageicons_path', drupal_get_path('module', 'languageicons') .'/flags/*.png');
      $js_settings['languageicons'][$path] = base_path() . str_replace('*', $lang_option['language']->language, $icons_path);
      ($settings['languageicons']['flag_position']) ? $flag_position = '#suffix' : $flag_position = '#prefix';
    }

to this

    // Handle flags with Language icons module using JS widget
    if (module_exists('languageicons') && $settings['js_widget']) {
      $language_icon = '';
      $icons_path = variable_get('languageicons_path', drupal_get_path('module', 'languageicons') .'/flags/*.png');
      $js_settings['languageicons'][$path] = base_path() . str_replace('*', $lang_option['language']->language, $icons_path);
      ($settings['languageicons']['flag_position']) ? $flag_position = '#suffix' : $flag_position = '#prefix';
    }

    if (module_exists('languageicons')) {
      ($settings['languageicons']['flag_position']) ? $flag_position = '#suffix' : $flag_position = '#prefix';
    }

No notices and icons are there

juves’s picture

Now, if change the language on a node, I get the same node and translated interface, not the translated node.

JGO’s picture

I applied #3, #4 & #5 and I can only say it works terrific. Please fix asap :)

My only problem left is that my layout gets a bit messed up inside the block.

metakel’s picture

I got the same error in line number 813.

And I can't apply the patches. They were rejected, no match I patched with -p0 or -p2.

Hope that there will be an integrated and patched module soon.

dbiot’s picture

After applying all these patches it seems to work because I see the language icons, but I still get error messages:

Notice: Undefined index: flag_position in lang_dropdown_form() (line 168 of /home/aurelied/domains/aurelie-david.be/public_html/modules/lang_dropdown/lang_dropdown.module).
Notice: Undefined index: flag_position in lang_dropdown_form() (line 172 of /home/aurelied/domains/aurelie-david.be/public_html/modules/lang_dropdown/lang_dropdown.module).
Notice: Undefined index: flag_position in lang_dropdown_form() (line 168 of /home/aurelied/domains/aurelie-david.be/public_html/modules/lang_dropdown/lang_dropdown.module).
Notice: Undefined index: flag_position in lang_dropdown_form() (line 172 of /home/aurelied/domains/aurelie-david.be/public_html/modules/lang_dropdown/lang_dropdown.module).
Notice: Undefined index: flag_position in lang_dropdown_form() (line 168 of /home/aurelied/domains/aurelie-david.be/public_html/modules/lang_dropdown/lang_dropdown.module).
Notice: Undefined index: flag_position in lang_dropdown_form() (line 172 of /home/aurelied/domains/aurelie-david.be/public_html/modules/lang_dropdown/lang_dropdown.module).

My theme is a custom Zen theme.

sag3r’s picture

I applied #3, #4 & #5 and I have 2 notices:

Notice: Undefined index: flag_position in lang_dropdown_form() (line 168 of /modules/lang_dropdown/lang_dropdown.module).

pebosi’s picture

Status: Active » Needs review

#3 works to fix the fatal error.

mohammed j. razem’s picture

Status: Needs review » Fixed

Should be fixed in new 7.x-1.0 release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.