Skip to content

Commit

Permalink
Fix potential array access on non array
Browse files Browse the repository at this point in the history
  • Loading branch information
ajbonner committed Jan 15, 2024
1 parent cf89cf0 commit 14496a7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/app/code/community/Zendesk/Zendesk/Model/Api/Tickets.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ public function forOrder($orderIncrementId)
]
);

if(count($response['results'])) {
// Check if $response['results'] is set and is an array before calling count()
// See https://github.com/agnostack/magento_extension/pull/185
if (isset($response['results']) && is_array($response['results']) && count($response['results'])) {
return $response['results'];
} else {
return false;
Expand Down

0 comments on commit 14496a7

Please sign in to comment.