3

I had been getting this error message:

PHP Fatal error: Unsupported operand types in /var/www/www.ruv.is/pressflow/includes/common.inc on line 1588

So I did a backtrace and this is what it returned:

    array (
      'file' => 'pressflow/includes/menu.inc',
      'line' => 1614,
      'function' => 'l',
    )

It points to this function:

/**
 * Get the breadcrumb for the current page, as determined by the active trail.
 */
function menu_get_active_breadcrumb() {
  $breadcrumb = array();

  // No breadcrumb for the front page.
  if (drupal_is_front_page()) {
    return $breadcrumb;
  }

  $item = menu_get_item();
  if ($item && $item['access']) {
    $active_trail = menu_get_active_trail();    

    foreach ($active_trail as $parent) {
      $breadcrumb[] = l($parent['title'], $parent['href'], $parent['localized_options']);  // line 1614
    }
    $end = end($active_trail);

    // Don't show a link to the current page in the breadcrumb trail.
    if ($item['href'] == $end['href'] || ($item['type'] == MENU_DEFAULT_LOCAL_TASK && $end['href'] != '<front>')) {
      array_pop($breadcrumb);
    }
  }
  return $breadcrumb;
}

Or more specifically, this line:

$breadcrumb[] = l($parent['title'], $parent['href'], $parent['localized_options']); 

I'm assuming there is a contributed module that is causing this, but it is happening on several pages that don't use any menu altering module. Do you have any idea on how to troubleshoot this?

I can't reproduce this myself, so my only chance of debugging is on a hight traffic live site.

  • 1
    Try to figure out for which path ($parent['href']) this happens, this might lead to you the module that's causing it. – Berdir Mar 1 '12 at 12:52
  • It seems random on which nodes this happens, never the same twice. – Karl Jóhann Mar 1 '12 at 13:17
  • Very weird. Is there a cache system live somewhere ? Asking because of the random nature of the problem ... – Countzero Mar 1 '12 at 15:39
  • Varnish is running, on a separate machine. – Karl Jóhann Mar 1 '12 at 17:21
3

According to my experience, this happens when the third argument passes to l() is not an array and you are using PHP 5.3. See http://api.drupal.org/api/drupal/includes%21common.inc/function/l/6 as to how the third parameter $options is being used.

Then it is time dwelve into what is causing your $parent['localized_options'] not to be an array.

  • This is exactly what I'm trying to find out, how would I find that out? – Karl Jóhann Mar 6 '12 at 23:58
  • Try applying the instructions in drupal.org/node/362799#comment-1542118 to $parent['localized_options'] conditionally: if it is not an array, debug_backtrace(). – kekkis Mar 7 '12 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.