Skip to content

Commit

Permalink
Update NovaPoshtaApi2.php
Browse files Browse the repository at this point in the history
NovaPoshtaApi2::prepare change if statement for array_key_exists, coz symfony returned status 500 with notice "Notice: Trying to access array offset on value of type null"
```if ($this->throwErrors and $result['errors']) {```
  • Loading branch information
maxcxam authored Aug 22, 2020
1 parent 4434901 commit 30de729
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Delivery/NovaPoshtaApi2.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ private function prepare($data)
? $data
: json_decode($data, 1);
// If error exists, throw Exception
if ($this->throwErrors and $result['errors']) {
if ($this->throwErrors and array_key_exists('errors', $result)) {
throw new \Exception(is_array($result['errors']) ? implode("\n", $result['errors']) : $result['errors']);
}
return $result;
Expand Down

0 comments on commit 30de729

Please sign in to comment.