Skip to content

Commit

Permalink
check if result is empty issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mkorkmaz committed Feb 19, 2021
1 parent 8d7263f commit 3a12baa
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/ReJSON/Command/Get.php
Expand Up @@ -22,7 +22,7 @@ private function __construct(
$this->arguments = [$key];
$this->arguments = array_merge($this->arguments, $paths);
$this->responseCallback = function ($result) {
if ($result !== null) {
if (!empty($result)) {
return json_decode($result);
}
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/ReJSON/Command/GetArray.php
Expand Up @@ -22,7 +22,7 @@ private function __construct(
$this->arguments = [$key];
$this->arguments = array_merge($this->arguments, $paths);
$this->responseCallback = function ($result) {
if ($result !== null) {
if (!empty($result)) {
return json_decode($result, (bool) JSON_OBJECT_AS_ARRAY, 512, JSON_THROW_ON_ERROR);
}
return null;
Expand Down
1 change: 0 additions & 1 deletion tests/Module/ReJSONTest.php
Expand Up @@ -174,7 +174,6 @@ public function shouldRunReJSONCommandMgetSuccessfully(): void
$this->reJsonModule->set('test', '.baz', 'qux');
$this->reJsonModule->set('test', '.baz', 'quux', 'XX');
$this->reJsonModule->set('test2', '.', ['foo2' => 'bar2']);
var_dump($this->reJsonModule->mgetArray('test', 'test2', '.'));
}

/**
Expand Down

0 comments on commit 3a12baa

Please sign in to comment.