From e783877676db07984a7425a7990c0ee91d9e1d1c Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Mon, 12 Jun 2017 17:11:59 -0700 Subject: [PATCH] Resolve PHP compatibility issue, fixes #29 --- inc/functions.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/inc/functions.php b/inc/functions.php index edc7fb9..3fda855 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -236,7 +236,14 @@ function checkCAPTCHA() { if ($failed_captcha) { $captcha_error = 'Failed CAPTCHA.'; - if (count($resp->getErrorCodes()) == 1 && $resp->getErrorCodes()[0] == 'missing-input-response') { + $error_reason = ''; + + if (count($resp->getErrorCodes()) == 1) { + $error_codes = $resp->getErrorCodes(); + $error_reason = $error_codes[0]; + } + + if ($error_reason == 'missing-input-response') { $captcha_error .= ' Please click the checkbox labeled "I\'m not a robot".'; } else { $captcha_error .= ' Reason:';