2
More information... the following line is causing the problem:
$block_arr[$block->getVar('mid')]['modname'] = $modules[$block->getVar('mid')]->getVar('name');
In the first iteration of the for ... each Statement
$block->getVar('mid') returns 0. I guess there is no module with 'mid' = 0 in the $modules object. I I think this is what is causing the error.
Maybe somehow may block-configuration got messed up?