From cba95c5eb19a33654a6f0995c6f9e0885b7afc20 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Mon, 27 Apr 2020 13:35:29 +0200 Subject: fix password max size add error in hydrate --- app/class/Bookmark.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'app/class/Bookmark.php') diff --git a/app/class/Bookmark.php b/app/class/Bookmark.php index bc77310..9e038aa 100644 --- a/app/class/Bookmark.php +++ b/app/class/Bookmark.php @@ -21,10 +21,12 @@ class Bookmark extends Item /** @var string $icon associated emoji */ protected $icon = '⭐'; - + /** + * @throws RuntimeException + */ public function __construct(array $datas = []) { - $this->hydrate($datas); + $this->hydrate($datas, true); } public function init(string $id, string $route, string $query, array $params = [], string $icon = '⭐') @@ -69,13 +71,19 @@ class Bookmark extends Item // _____________________________ S E T __________________________________ - public function setid($id) + public function setid($id): bool { if (is_string($id)) { - $this->id = idclean($id); + try { + $this->id = idclean($id, Model::MAX_ID_LENGTH, 1); + } catch (\Throwable $th) { + return false; + } + return true; } + return false; } - + public function setquery($query) { if (is_string($query)) { @@ -87,6 +95,9 @@ class Bookmark extends Item { if ($route === 'home' || $route === 'media') { $this->route = $route; + return true; + } else { + return false; } } -- cgit v1.2.3