Skip to content

Commit

Permalink
check for http response errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyvankooten committed Nov 7, 2024
1 parent 2b03c4b commit 15e88fe
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions integrations/prosopo-procaptcha/class-procaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,11 @@ protected function is_human_made_request()
)
);

if (true === is_wp_error($response)) {
// something went wrong, maybe connection issue, but we still shouldn't allow the request.
// Check if request failed, either locally or remotely
if (true === is_wp_error($response) || wp_remote_retrieve_response_code($response) >= 400) {
/** @var MC4WP_Debug_Log */
$logger = mc4wp('log');
$logger->error(sprintf('ProCaptcha request error: %d %s - %s', wp_remote_retrieve_response_code($response), wp_remote_retrieve_response_message($response), wp_remote_retrieve_body($response)));
return false;
}

Expand Down

0 comments on commit 15e88fe

Please sign in to comment.