Skip to content

Commit

Permalink
Merge pull request #9 from salahhusa9/fix/problem-of-result
Browse files Browse the repository at this point in the history
Add error handling for empty or missing response
  • Loading branch information
salahhusa9 authored Nov 12, 2024
2 parents 906677b + c43270b commit 57b0c0b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/GeetestCaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public function validate($value)
$obj = json_decode($res, true);
$this->validatedData = $obj;

if (empty($obj) or ! isset($obj['result'])) {
return false;
}

if ($obj['result'] != 'success') {
return false;
}
Expand Down

0 comments on commit 57b0c0b

Please sign in to comment.