From e78aba8c88fd05bb9170d136e188b90fc20eb831 Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Wed, 27 Nov 2024 12:41:48 +0100 Subject: [PATCH] ITKDev: Fixes must not be accessed before initialization --- src/LookupResult/CompanyLookupResult.php | 2 +- src/LookupResult/CprLookupResult.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LookupResult/CompanyLookupResult.php b/src/LookupResult/CompanyLookupResult.php index cf21e9e..1ab4ef0 100644 --- a/src/LookupResult/CompanyLookupResult.php +++ b/src/LookupResult/CompanyLookupResult.php @@ -352,7 +352,7 @@ public function setAddress(string $address): void { * The field value or the empty string if the field does not exist. */ public function getFieldValue(string $field): mixed { - if (property_exists($this, $field)) { + if (property_exists($this, $field) && isset($this->{$field})) { return $this->{$field}; } diff --git a/src/LookupResult/CprLookupResult.php b/src/LookupResult/CprLookupResult.php index 1b9f67c..0b254d3 100644 --- a/src/LookupResult/CprLookupResult.php +++ b/src/LookupResult/CprLookupResult.php @@ -672,7 +672,7 @@ public function hasGuardian(string $cpr): bool { * The value of the field or the empty string. */ public function getFieldValue(string $field): mixed { - if (property_exists($this, $field)) { + if (property_exists($this, $field) && isset($this->{$field})) { return $this->{$field}; }