Why does module_invoke() return an empty array for anonymous users? I'm using module_invoke to return an array of blocks in a hook_block_list_alter

function MY_MODULE_block_list_alter(&amp;$blocks) {

 $foo = &amp;drupal_static('foo');
 foreach ($blocks as $key =&gt; $block) {
  if ($block-&gt;module == 'bean') {
   $bar = module_invoke($block-&gt;module, 'block_view ', $block-&gt;delta);
   $foo[] = $bar;
  }
 }
 return $foo;
}


When I'm logged in with admin privileges, $bar will be an array containing $bar['content'], $bar['subject'] etc. But for anonymous users, the array is empty. I can't find any reason for this, hopefully I'm missing something obvious and easy (to others!).
You are invoking the function bean_block_view(), which contains this code:

if (bean_access('view', $bean) &amp;&amp; $bean) {
  $content = $bean-&gt;view($bean-&gt;view_mode);
  if (!is_array($content)) {
    $content = array(
      '#markup' =&gt; $content,
    );
  }

  $return = array(
    'content' =&gt; $content, 
    'subject' =&gt; isset($bean-&gt;title) ? $bean-&gt;title : '',
  );
}


Looking at the first line of code, you can see the block is only built if the viewer has 'view' access for beans.

So it's a permissions issue of some sort with the beans module. Anonymous users don't have the required permission, so the block is empty.