The other options for each link work fine but adding a custom class to my home button gives me:

Fatal error: [] operator not supported for strings in ...includes/common.inc on line 2277

When I am on the front page when the menu is ready to load. That line in common.inc seems to add the "active" class to that link causing a conflict:

$options['attributes']['class'][] = 'active';

I tried to see if the dev version fixed the issue but no luck

Comments

Dave Reid’s picture

Status: Active » Closed (cannot reproduce)

I can't duplicate this with the latest Drupal core. It looks like there was patch that went in with #283723: Make menu_tree_output() return renderable output on Sept 18 2009 that addressed this.

nadavoid’s picture

Status: Closed (cannot reproduce) » Active

I am also seeing this error.

Using Drupal 7 RC1 and menu_attributes 7.x-1.0-beta1. PHP 5.2.12.

The error message points to line 2284 in common.inc now. A little more context:

  // Append active class.
  if (($path == $_GET['q'] || ($path == '<front>' && drupal_is_front_page())) &&
      (empty($options['language']) || $options['language']->language == $language_url->language)) {
    $options['attributes']['class'][] = 'active';
  }

It only happens if I'm on a page (home page, in my case) that causes a menu item to be designated as "active". If that menu item also has a custom class added by the menu_attributes module, I get the reported fatal error.

Dave Reid’s picture

Status: Active » Postponed (maintainer needs more info)

Please try re-saving your menu item with the latest 7.x-1.x-dev. There was a fix that went in to convert classes to an array on save, which should fix this issue.

nadavoid’s picture

That fixed the issue for me. I added a class back in and resaved the menu item. It appears in the markup without error now! Thanks Dave!

robato’s picture

This also fixed the issue for me as well. However, it took me a good 20 minutes to find the 7.x-1.x-dev file to overwrite the beta version. Is there a way you can add the dev version to the http://drupal.org/project/menu_attributes

Im sorry if I sound like a moron for making such a request, I dont know how the drupal development system works.

Dave Reid’s picture

I enabled the dev release, although I'll likely be creating new releases today anyway.

Dave Reid’s picture

Status: Postponed (maintainer needs more info) » Fixed

Status: Fixed » Closed (fixed)

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

prnorth’s picture

Issue summary: View changes

I just updated a Drupal 6 site to Drupal 7 today after several failed attemps and have run into this error. I/'ve spent most of today trying to figure it out.

This is the error I get:

Fatal error: [] operator not supported for strings in /homepages/24/d255011919/htdocs/includes/common.inc on line 2487

and it appears to relate to this line in common.inc

// Merge in defaults.
  $options += array(
    'attributes' => array(),
    'html' => FALSE,
  );