From 976d6bbd1f9c7b1431688c17eabe954a5d58f621 Mon Sep 17 00:00:00 2001 From: lsces Date: Fri, 29 Aug 2025 13:21:49 +0100 Subject: ReCaptcha updated to PHP8.4 and namespace --- includes/recaptcha/ReCaptcha/ReCaptcha.php | 2 +- includes/recaptcha/ReCaptcha/Response.php | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) mode change 100644 => 100755 includes/recaptcha/ReCaptcha/ReCaptcha.php mode change 100644 => 100755 includes/recaptcha/ReCaptcha/Response.php (limited to 'includes') diff --git a/includes/recaptcha/ReCaptcha/ReCaptcha.php b/includes/recaptcha/ReCaptcha/ReCaptcha.php old mode 100644 new mode 100755 index d75ce1f..6984d0a --- a/includes/recaptcha/ReCaptcha/ReCaptcha.php +++ b/includes/recaptcha/ReCaptcha/ReCaptcha.php @@ -169,7 +169,7 @@ class ReCaptcha $params = new RequestParameters($this->secret, $response, $remoteIp, self::VERSION); $rawResponse = $this->requestMethod->submit($params); $initialResponse = Response::fromJson($rawResponse); - $validationErrors = array(); + $validationErrors = []; if (isset($this->hostname) && strcasecmp($this->hostname, $initialResponse->getHostname()) !== 0) { $validationErrors[] = self::E_HOSTNAME_MISMATCH; diff --git a/includes/recaptcha/ReCaptcha/Response.php b/includes/recaptcha/ReCaptcha/Response.php old mode 100644 new mode 100755 index 8a5d3aa..b73d71a --- a/includes/recaptcha/ReCaptcha/Response.php +++ b/includes/recaptcha/ReCaptcha/Response.php @@ -49,7 +49,7 @@ class Response * Error code strings. * @var array */ - private $errorCodes = array(); + private $errorCodes = []; /** * The hostname of the site where the reCAPTCHA was solved. @@ -95,14 +95,14 @@ class Response return new Response(false, array(ReCaptcha::E_INVALID_JSON)); } - $hostname = isset($responseData['hostname']) ? $responseData['hostname'] : ''; - $challengeTs = isset($responseData['challenge_ts']) ? $responseData['challenge_ts'] : ''; - $apkPackageName = isset($responseData['apk_package_name']) ? $responseData['apk_package_name'] : ''; + $hostname = isset($responseData['hostname']) ? $responseData['hostname'] : null; + $challengeTs = isset($responseData['challenge_ts']) ? $responseData['challenge_ts'] : null; + $apkPackageName = isset($responseData['apk_package_name']) ? $responseData['apk_package_name'] : null; $score = isset($responseData['score']) ? floatval($responseData['score']) : null; - $action = isset($responseData['action']) ? $responseData['action'] : ''; + $action = isset($responseData['action']) ? $responseData['action'] : null; if (isset($responseData['success']) && $responseData['success'] == true) { - return new Response(true, array(), $hostname, $challengeTs, $apkPackageName, $score, $action); + return new Response(true, [], $hostname, $challengeTs, $apkPackageName, $score, $action); } if (isset($responseData['error-codes']) && is_array($responseData['error-codes'])) { @@ -123,7 +123,7 @@ class Response * @param string $action * @param array $errorCodes */ - public function __construct($success, array $errorCodes = array(), $hostname = '', $challengeTs = '', $apkPackageName = '', $score = null, $action = '') + public function __construct($success, array $errorCodes = [], $hostname = null, $challengeTs = null, $apkPackageName = null, $score = null, $action = null) { $this->success = $success; $this->hostname = $hostname; -- cgit v1.3