Skip to content

Commit 15e88fe

Browse files
check for http response errors
1 parent 2b03c4b commit 15e88fe

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

integrations/prosopo-procaptcha/class-procaptcha.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,11 @@ protected function is_human_made_request()
209209
)
210210
);
211211

212-
if (true === is_wp_error($response)) {
213-
// something went wrong, maybe connection issue, but we still shouldn't allow the request.
212+
// Check if request failed, either locally or remotely
213+
if (true === is_wp_error($response) || wp_remote_retrieve_response_code($response) >= 400) {
214+
/** @var MC4WP_Debug_Log */
215+
$logger = mc4wp('log');
216+
$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)));
214217
return false;
215218
}
216219

0 commit comments

Comments
 (0)