Block on specific pages and node types
To actually fix that error, see my answer to a stackoverflow question.

However, in that case, your code can be simplified a lot using menu_get_object():

$types = array('middle_content' =&gt; 1);
if ($node = menu_get_object()) {
  if (isset($types[$node-&gt;type])) {
    return TRUE;
  }
}


And anyway, you should avoid PHP in blocks etc (See What are the downsides of using PHP Filter code in blocks, nodes, views-args, etc?), check out Context. It allows you to configure your blocks (among other things) for conditions exactly like this without having to write code. It is also much faster.