Commit 1c7dd5c2 authored by Nigel McNie's avatar Nigel McNie
Browse files

Don't allow get_artefacts returning empty artefact IDs to break rebuild_artefact_list()



This behaviour has been observed once or twice from badly written
get_artefacts() methods. We now make sure all the artefact IDs returned
are checked to be integers.
Signed-off-by: default avatarNigel McNie <nigel@catalyst.net.nz>
parent 8f6de1e8
......@@ -806,7 +806,19 @@ class BlockInstance {
db_commit();
return true;
}
foreach ($artefacts as $key => $id) {
if (!$id || intval($id) == 0) {
log_warn("get_artefacts returned an invalid artefact ID for block instance $this->id (" . $this->get('blocktype') . ")");
unset($artefacts[$key]);
}
}
if (count($artefacts) == 0) {
db_commit();
return true;
}
// Get list of allowed artefacts
require_once('view.php');
$searchdata = array(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment