mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 14:05:29 +02:00
FIX Don't assume DataObject::canView always returns bool (#306)
Because there is no return value typehinting in DataObject::canView, the value returned from that method can be of any type. We must cast to boolean before returning the value to avoid possible errors with non-boolean return types.
This commit is contained in:
parent
8ac7964220
commit
2c0e2df02d
@ -151,12 +151,12 @@ class SearchableService
|
|||||||
// Anonymous member canView() for indexing
|
// Anonymous member canView() for indexing
|
||||||
if (!$this->classSkipsCanViewCheck($objClass)) {
|
if (!$this->classSkipsCanViewCheck($objClass)) {
|
||||||
$value = Member::actAs(null, function () use ($obj) {
|
$value = Member::actAs(null, function () use ($obj) {
|
||||||
return $obj->canView();
|
return (bool) $obj->canView();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Current member canView() check for retrieving search results
|
// Current member canView() check for retrieving search results
|
||||||
$value = $obj->canView();
|
$value = (bool) $obj->canView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->extend('updateIsSearchable', $obj, $indexing, $value);
|
$this->extend('updateIsSearchable', $obj, $indexing, $value);
|
||||||
|
Loading…
Reference in New Issue
Block a user