Skip to content

Commit 14496a7

Browse files
committed
Fix potential array access on non array
See agnostack#185 and agnostack#181
1 parent cf89cf0 commit 14496a7

File tree

1 file changed

+3
-1
lines changed
  • src/app/code/community/Zendesk/Zendesk/Model/Api

1 file changed

+3
-1
lines changed

src/app/code/community/Zendesk/Zendesk/Model/Api/Tickets.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ public function forOrder($orderIncrementId)
8282
]
8383
);
8484

85-
if(count($response['results'])) {
85+
// Check if $response['results'] is set and is an array before calling count()
86+
// See https://github.com/agnostack/magento_extension/pull/185
87+
if (isset($response['results']) && is_array($response['results']) && count($response['results'])) {
8688
return $response['results'];
8789
} else {
8890
return false;

0 commit comments

Comments
 (0)