From aa3a54f237cbf1907c8989fac34b5a2f2c016851 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Sat, 11 Mar 2023 21:39:20 +0100 Subject: [PATCH] Asset: guard using property_exists in constructor --- models/Asset.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/models/Asset.php b/models/Asset.php index 483c799..bdf6b38 100644 --- a/models/Asset.php +++ b/models/Asset.php @@ -27,7 +27,10 @@ class Asset protected function __construct(array $data) { foreach ($data as $attribute => $value) - $this->$attribute = $value; + { + if (property_exists($this, $attribute)) + $this->$attribute = $value; + } if (!empty($data['date_captured']) && $data['date_captured'] !== 'NULL') $this->date_captured = new DateTime($data['date_captured']);