Copied Block Error: getAreaHandle()

Permalink
Today, I upgrade c5 from 5.7.5.6 to 5.7.5.9.
No issues while update.
Issue is coming when I try to access frontpage.
My website is multilanguage website, so I have many block in stack, copied from another stack.
All the copied block return :
PHP Fatal error:  Call to a member function getAreaHandle() on null in /home/user/public_html/concrete/src/Block/Block.php on line 401

This error, indicate "BlockView" can't get an area for the block.
I used some code that may causing this error, but I don't really know what it is. Before it works like charm, but after update, seems not working again.
This is the code I used:
$stack = Stack::getByName("Services");
$blocks   = $stack->getBlocks(STACKS_AREA_NAME);
foreach ($blocks as $block) {
   $b   = Block::getByID($block->bID);
   echo '<li>';
   echo '<div class="service-icon"><i class="icon-'.$b->getBlockName().'"></i></div>';
   $b->display();
   echo '</li>';
}

Note: This problem only happen on copied block, reference block still working.

Thanks for help.

goesredy
 
goesredy replied on at Permalink Best Answer Reply
goesredy
Fix with direct use of $block object, instead of call Block class again.