From adb9f05bafebd0046d0390e5bb809d691a2e2075 Mon Sep 17 00:00:00 2001 From: Bruno Vitorino Date: Tue, 7 May 2019 14:10:33 +0200 Subject: [PATCH] Add some safe programming The array is coming from an API call so it's not safe to assume the array key exists. --- Gateway/MailChimpSubscriberGateway.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gateway/MailChimpSubscriberGateway.php b/Gateway/MailChimpSubscriberGateway.php index 0e697af..dc607ec 100644 --- a/Gateway/MailChimpSubscriberGateway.php +++ b/Gateway/MailChimpSubscriberGateway.php @@ -133,7 +133,7 @@ public function hasStatus(string $email, string $listId, string $status): bool ); // we have found a member - if (is_array($member) && !empty($member)) { + if (is_array($member) && !empty($member) && array_key_exists('status', $member)) { return ($member['status'] === $status); }