After installing this module on my site (latest release of drupal and module), an anonymous visitor was presented with the WSOD with error
Fatal error: Unsupported operand types in MYSITE/includes/common.inc on line 1582

I am using many other modules so it could be an interaction with another module, but sure put me off using this module on a production site!

CommentFileSizeAuthor
#5 674288_validate_l_input.patch406 bytesjuliebaumler

Comments

gmateos’s picture

Hi guys, I had the same problem that tallsimon reported and I fixed adding some code to _menu_icons_menu_item_link function:

function _menu_icons_menu_item_link($link) {
  if ($link['options']['icon']['enable'] && file_exists($link['options']['icon']['path'])) {
    $link['localized_options']['html'] = TRUE;
    $link['localized_options']['attributes']['class'] = "menu_icon menu-". $link['mlid'];
    return l($link['title'], $link['href'], $link['localized_options']);
  }
  else {
  // gmateos - start - hacking to fix link error
    if (!isset($link['localized_options'])) {
    $link['localized_options']=array();
    }
    // gmateos - end hack
    return l($link['title'], $link['href'], $link['localized_options']);
  }
}

The error appear with a link generated by panels module, when logged only.
Hear is the error stack:

Wed Feb 03 20:05:53 2010] [error] [client 127.0.0.1] PHP Fatal error:  Unsupported operand types in F:\\includes\\common.inc on line 1582, referer: http://localhost:8280/drupal/admin/build/modules
[Wed Feb 03 20:05:53 2010] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://localhost:8280/drupal/admin/build/modules
[Wed Feb 03 20:05:53 2010] [error] [client 127.0.0.1] PHP   1. {main}() F:\\index.php:0, referer: http://localhost:8280/drupal/admin/build/modules
[Wed Feb 03 20:05:53 2010] [error] [client 127.0.0.1] PHP   2. menu_execute_active_handler() F:\\index.php:18, referer: http://localhost:8280/drupal/admin/build/modules
[Wed Feb 03 20:05:53 2010] [error] [client 127.0.0.1] PHP   3. call_user_func_array() F:\\includes\\menu.inc:348, referer: http://localhost:8280/drupal/admin/build/modules
[Wed Feb 03 20:05:53 2010] [error] [client 127.0.0.1] PHP   4. page_manager_page_execute() F:\\includes\\menu.inc:0, referer: http://localhost:8280/drupal/admin/build/modules
[Wed Feb 03 20:05:53 2010] [error] [client 127.0.0.1] PHP   5. ctools_context_handler_render() F:\\sites\\all\\modules\\ctools\\page_manager\\plugins\\tasks\\page.inc:335, referer: http://localhost:8280/drupal/admin/build/modules
[Wed Feb 03 20:05:53 2010] [error] [client 127.0.0.1] PHP   6. theme() F:\\sites\\all\\modules\\ctools\\includes\\context-task-handler.inc:95, referer: http://localhost:8280/drupal/admin/build/modules
[Wed Feb 03 20:05:53 2010] [error] [client 127.0.0.1] PHP   7. call_user_func_array() F:\\includes\\theme.inc:658, referer: http://localhost:8280/drupal/admin/build/modules
[Wed Feb 03 20:05:53 2010] [error] [client 127.0.0.1] PHP   8. template_preprocess_page() F:\\includes\\theme.inc:0, referer: http://localhost:8280/drupal/admin/build/modules
[Wed Feb 03 20:05:53 2010] [error] [client 127.0.0.1] PHP   9. theme() F:\\includes\\theme.inc:1814, referer: http://localhost:8280/drupal/admin/build/modules
[Wed Feb 03 20:05:53 2010] [error] [client 127.0.0.1] PHP  10. call_user_func_array() F:\\includes\\theme.inc:617, referer: http://localhost:8280/drupal/admin/build/modules
[Wed Feb 03 20:05:53 2010] [error] [client 127.0.0.1] PHP  11. ctools_menu_help() F:\\includes\\theme.inc:0, referer: http://localhost:8280/drupal/admin/build/modules
[Wed Feb 03 20:05:53 2010] [error] [client 127.0.0.1] PHP  12. ctools_menu_get_active_help() F:\\sites\\all\\modules\\ctools\\includes\\menu.inc:436, referer: http://localhost:8280/drupal/admin/build/modules
[Wed Feb 03 20:05:53 2010] [error] [client 127.0.0.1] PHP  13. ctools_menu_tab_root_path() F:\\sites\\all\\modules\\ctools\\includes\\menu.inc:446, referer: http://localhost:8280/drupal/admin/build/modules
[Wed Feb 03 20:05:53 2010] [error] [client 127.0.0.1] PHP  14. ctools_menu_local_tasks() F:\\sites\\all\\modules\\ctools\\includes\\menu.inc:475, referer: http://localhost:8280/drupal/admin/build/modules
[Wed Feb 03 20:05:53 2010] [error] [client 127.0.0.1] PHP  15. theme() F:\\sites\\all\\modules\\ctools\\includes\\menu.inc:335, referer: http://localhost:8280/drupal/admin/build/modules
[Wed Feb 03 20:05:53 2010] [error] [client 127.0.0.1] PHP  16. call_user_func_array() F:\\includes\\theme.inc:617, referer: http://localhost:8280/drupal/admin/build/modules
[Wed Feb 03 20:05:53 2010] [error] [client 127.0.0.1] PHP  17. _menu_icons_menu_item_link() F:\\includes\\theme.inc:0, referer: http://localhost:8280/drupal/admin/build/modules
[Wed Feb 03 20:05:53 2010] [error] [client 127.0.0.1] PHP  18. l() F:\\sites\\all\\modules\\menu_icons\\menu_icons.module:250, referer: http://localhost:8280/drupal/admin/build/modules

I think that applying the hack will solve the problem. Hope this help

hefox’s picture

Using the latest .module from the repo seems to get rid of the error, but I couldn't get that version other than manually or cvs checkout; won't drush dl or anything.

skilip’s picture

Probably fixed as well with release 6.x-2.1

skilip’s picture

Status: Active » Closed (fixed)
juliebaumler’s picture

Project: Menu Icons » Fix Core
Version: 6.x-2.0 » 6.x-1.0
Priority: Critical » Normal
Status: Closed (fixed) » Active
StatusFileSize
new406 bytes

I ran into this same situation (without using menu_items) and traced it back to the fact that the l() function does not validate its input, but instead assumes that if it is given a third argument, that argument is an array. The above issues (and mine) result from that third argument being blank. There are several places within various menu related modules (and perhaps elsewhere) where this can happen. I've attached a patch that just casts the argument to array. (This is more efficient than checking for an array in php.)

salvis’s picture

Project: Fix Core » Drupal core
Version: 6.x-1.0 » 6.x-dev
Component: Code » base system
Status: Active » Needs work

Thank you for moving this my way, but I'm afraid this can only be fixed directly in core. A contrib module cannot replace (or augment) a core function, unless that function is designed to be extensible.

Moreover your primary approach for getting things fixed should be to provide patches to core. The Fix Core module is a back-up solution for cases where the primary approach fails, in cases where a core bug can be worked around at all.

My personal view is that core should be made as robust as possible where this can be done with little effort, and this seems to be such a case, but there are others who will say that the offending modules need to be fixed and core should not to bend one bit to accommodate contrib modules that misbehave.

Just to give you a jump start: According to the Drupal coding guidelines, comments must start with a capital letter and end with a period. Also, you'll need to check whether the same issue is present in D7. If it is, then it needs to be fixed there first.

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.