Question about Block::getByID in concrete5 8.5.2

Permalink
concrete5 8.5.2

$bID = $_GET['bID'];//i received block id 31
$b = Block::getByID($bID);
$controller = $b->getController();

ERROR: controller on null

1 Attachment

View Replies:
JohntheFish replied on at Permalink Reply
JohntheFish
If the bID cannot be loaded, then $b is null rather than a block object. Hence the error.

A likely reason is that bID changes each time a block is edited.

Seeing that your problem is in ProEvents, the bad news is that ProEvents is broken and not compatible with current v8 core.

A long shot - if you have caching enabled, that could be another reason for a bID being old.