Fatal error: Unsupported operand types in form.inc I'm getting the following error message:


  Fatal error: Unsupported operand types in /var/www/public_html/domain.com/includes/form.inc on line 1079


It seems to be because the following code for an admin menu.

function MY_MODULE_admin_menu() {
  $menu_items = db_query("SELECT * FROM my_module")-&gt;fetchAll();
  $header = array('Template ID', 'Name', 'Type', 'Template');
  $rows = array();
  if (!empty($menu_items)) {
    foreach ($menu_items as $menu_item) {
      $rows[] = array($menu_item-&gt;tid, $menu_item-&gt;name, $menu_item-&gt;type, $menu_item-&gt;template);
    }
  }
  return theme_table(array(
    "header" =&gt; $header,
    "rows" =&gt; $rows,
    "attributes" =&gt; array(),
    "sticky" =&gt; true,
    "caption" =&gt; "",
    "colgroups" =&gt; array(),
    "empty" =&gt; t("Table has no rows"),
      )
  );
}


What's causing this? As far as I can tell, this is how it is supposed to look for Drupal 7.
Duplicate of this question:

Db_Query Fatal error: Unsupported operand types

It turns out that I was setting my page callback to a drupal_get_form with no form present.

I changed my hook_menu to:

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

  $items['admin/structure/module'] = array(
    'title' =&gt; 'description of module',
    'description' =&gt; 'Configure settings for module',
    'page callback' =&gt; 'MY_MODULE_admin_menu',
    'access arguments' =&gt; array('administer site configuration'),
  );

  return $items;
}


And it worked fine.