Skip to content

Commit

Permalink
Fixing boolean array index attempt if response is false instead of array
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Vince authored and Mark Vince committed Aug 22, 2023
1 parent 3edac25 commit fe5f724
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Lib/ElasticSearchRequest.php
Expand Up @@ -136,7 +136,7 @@ public function createIndex($index, $request = array()) {
$request['body'] = '';
$data = $this->request($request);

if ($data['_code'] != 200) {
if (empty($data) || (!empty($data) && $data['_code'] != 200)) {
return false;
}

Expand Down Expand Up @@ -176,7 +176,7 @@ public function createMapping($mapping, $request = array()) {
$request['uri']['path'] .= '/_mapping';
$request['body'] = $this->asJson($mapping);
$data = $this->request($request);
return $data['_code'] == 200;
return !empty($data) && $data['_code'] == 200;
}

public function getMapping($request = array()) {
Expand Down

0 comments on commit fe5f724

Please sign in to comment.