From b4a92124ff5207442127aebff27e25b75591b050 Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Fri, 15 Nov 2024 08:40:25 -0800 Subject: [PATCH] Use array_key_exists instead of isset For better handling of null values. --- src/MinFraud.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/MinFraud.php b/src/MinFraud.php index c0e6167..d58a6ae 100644 --- a/src/MinFraud.php +++ b/src/MinFraud.php @@ -201,7 +201,7 @@ public function withDevice( } $acceptLanguage = $this->remove($values, 'accept_language'); $ipAddress = $this->remove($values, 'ip_address'); - if (isset($values['session_age'])) { + if (\array_key_exists('session_age', $values)) { $v = $this->remove($values, 'session_age', ['double', 'float', 'integer', 'string']); if ($v !== null) { if (!is_numeric($v)) { @@ -210,7 +210,7 @@ public function withDevice( $sessionAge = (float) $v; } } - if (isset($values['session_id'])) { + if (\array_key_exists('session_id', $values)) { $v = $this->remove($values, 'session_id', ['integer', 'string']); if ($v !== null) { $sessionId = (string) $v; @@ -1279,7 +1279,7 @@ public function withShoppingCartItem( } $category = $this->remove($values, 'category'); - if (isset($values['item_id'])) { + if (\array_key_exists('item_id', $values)) { $v = $this->remove($values, 'item_id', ['integer', 'string']); if ($v !== null) { $itemId = (string) $v;