From dec2b042a79ce352e6f52e654ebc0dfe593efdcf Mon Sep 17 00:00:00 2001 From: Alex Narvey Date: Tue, 21 Jun 2022 09:35:52 -0500 Subject: [PATCH] Update caching_model.php To avoid the errors: PHP Notice: Trying to access array offset on value of type null in /Users/Shared/munkireport-php/vendor/munkireport/caching/caching_model.php on line 209 PHP Notice: Trying to access array offset on value of type null in /Users/Shared/munkireport-php/vendor/munkireport/caching/caching_model.php on line 256 --- caching_model.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/caching_model.php b/caching_model.php index 4a0a434..5fc35bc 100755 --- a/caching_model.php +++ b/caching_model.php @@ -206,7 +206,8 @@ public function process($data) // Traverse the caching object with translations foreach ($translate as $search => $field) { - if (! is_array($cachingjson[0]["result"])){ + //if (! is_array($cachingjson[0]["result"])){ + if (! is_array($cachingjson) || ! is_array($cachingjson[0]["result"] ?? false )) continue; { // If not an array, null the field $this->$field = ''; @@ -262,7 +263,8 @@ public function process($data) $this->create(); // Process exact_metrics, if it exists - if($cachingjson[0]["result"]['exact_metrics']){ + //if($cachingjson[0]["result"]['exact_metrics']){ + if(isset($cachingjson[0]["result"])) if($cachingjson[0]["result"]['exact_metrics']){ $pastThirtyone = (time()-2678400); // Split entries into array $exact_array = explode("__", $cachingjson[0]["result"]['exact_metrics']); @@ -357,3 +359,4 @@ public function process($data) } } // End process() } +