Fatal error: Unsupported operand types in includes/common.inc on line 1435

cakezula - March 26, 2008 - 17:19

hello,
the error page displays when i try to edit a menu i created called "Menu". i was adding to this menu last night and it has been in development for weeks so i have no idea what happened here. the last thing i did before i noticed this error was install the webform module, though i have since uninstalled it, devel, cssinjector... anything trying to get rid of the problem. i've seen other posts about the Views module, but this is just menue, and only a menu i created. primary, secondary links, etc are fine. please help!
thank you,
dave

link to error:
http://outugo.s463.sureserver.com/?q=admin/build/menu-customize/menu-mai...

line 1435 is the last line of this:

function l($text, $path, $options = array()) {
// Merge in defaults.
$options += array(
'attributes' => array(),
'html' => FALSE,
); <--- line 1435

a larger selection of the common.inc file below

/**
* Format an internal Drupal link.
*
* This function correctly handles aliased paths, and allows themes to highlight
* links to the current page correctly, so all internal links output by modules
* should be generated by this function if possible.
*
* @param $text
* The text to be enclosed with the anchor tag.
* @param $path
* The Drupal path being linked to, such as "admin/content/node". Can be an
* external or internal URL.
* - If you provide the full URL, it will be considered an external URL.
* - If you provide only the path (e.g. "admin/content/node"), it is
* considered an internal link. In this case, it must be a system URL
* as the url() function will generate the alias.
* - If you provide '', it generates a link to the site's
* base URL (again via the url() function).
* - If you provide a path, and 'alias' is set to TRUE (see below), it is
* used as is.
* @param $options
* An associative array of additional options, with the following keys:
* 'attributes'
* An associative array of HTML attributes to apply to the anchor tag.
* 'query'
* A query string to append to the link, or an array of query key/value
* properties.
* 'fragment'
* A fragment identifier (named anchor) to append to the link.
* Do not include the '#' character.
* 'absolute' (default FALSE)
* Whether to force the output to be an absolute link (beginning with
* http:). Useful for links that will be displayed outside the site, such
* as in an RSS feed.
* 'html' (default FALSE)
* Whether the title is HTML, or just plain-text. For example for making
* an image a link, this must be set to TRUE, or else you will see the
* escaped HTML.
* 'alias' (default FALSE)
* Whether the given path is an alias already.
* @return
* an HTML string containing a link to the given path.
*/
function l($text, $path, $options = array()) {
// Merge in defaults.
$options += array(
'attributes' => array(),
'html' => FALSE,
);

// Append active class.
if ($path == $_GET['q'] || ($path == '' && drupal_is_front_page())) {
if (isset($options['attributes']['class'])) {
$options['attributes']['class'] .= ' active';
}
else {
$options['attributes']['class'] = 'active';
}
}

// Remove all HTML and PHP tags from a tooltip. For best performance, we act only
// if a quick strpos() pre-check gave a suspicion (because strip_tags() is expensive).
if (isset($options['attributes']['title']) && strpos($options['attributes']['title'], '<') !== FALSE) {
$options['attributes']['title'] = strip_tags($options['attributes']['title']);
}

return ''. ($options['html'] ? $text : check_plain($text)) .'';
}

/**
* Perform end-of-request tasks.
*
* This function sets the page cache if appropriate, and allows modules to
* react to the closing of the page by calling hook_exit().
*/
function drupal_page_footer() {
if (variable_get('cache', CACHE_DISABLED) != CACHE_DISABLED) {
page_set_cache();
}

module_invoke_all('exit');
}

I'm having the same error!

wpanssi - October 23, 2008 - 20:39

I'm having the same error! Does someone know how to get rid of it??

--
http://www.sitemedia.fi
http://webgallup.com

Easy workaround, if you're using hook_menu

prinds - October 25, 2009 - 12:22

Hi,

I had a similar problem. I had made my own menu, and a through hook_menu in my custom module, I added items to the menu.

I got the same error, when trying to edit the menu.

By following the guide How to fix the Unsupported operand types error in Drupal 6 which bobthecow links to, I found that the problem had to do with the $options argument being an empty string instead of an array.

I then tried adding a new line "'weight' => 20," to my menu hook and voila, problem gone..

This is my code in hook_menu

function mymodule_menu() {
  $items = array();

  $items['custompage'] = array(
    'title' => 'Custom Page',
    'description' => 'Description',
    'page callback' => 'mymodule_show_custompage',
    'access callback' => TRUE,
    'type' => MENU_NORMAL_ITEM,
    'menu_name' => 'menu-mainmenu',
    'weight' => 20,
  );

  return $items;
}

It seems the weight attribute adds something to the options argument, though I'm not sure, that this is the right explanation.

I hope this is useful for someone..

 
 

Drupal is a registered trademark of Dries Buytaert.