diff --git a/system/src/Grav/Framework/Flex/FlexDirectory.php b/system/src/Grav/Framework/Flex/FlexDirectory.php index 2723b9154..cc799cb8d 100644 --- a/system/src/Grav/Framework/Flex/FlexDirectory.php +++ b/system/src/Grav/Framework/Flex/FlexDirectory.php @@ -212,13 +212,17 @@ class FlexDirectory implements FlexAuthorizeInterface } /** + * Returns an object if it exists. + * + * Note: It is not safe to use the object without checking if the user can access it. + * * @param string $key * @param string|null $keyField Field to be used as the key. * @return FlexObject|null */ public function getObject($key, string $keyField = null) : ?FlexObject { - return $this->getCollection(null, $keyField)->get($key); + return $this->getIndex(null, $keyField)->get($key); } /**