Skip to content

Commit f4c4e7c

Browse files
authored
Merge pull request google#491 from anprok/php81-deprecation-fix
Fix PHP 8.1 deprecations are being triggered in Response.php.
2 parents 21cf1a7 + a034671 commit f4c4e7c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/ReCaptcha/Response.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ public static function fromJson($json)
9595
return new Response(false, array(ReCaptcha::E_INVALID_JSON));
9696
}
9797

98-
$hostname = isset($responseData['hostname']) ? $responseData['hostname'] : null;
99-
$challengeTs = isset($responseData['challenge_ts']) ? $responseData['challenge_ts'] : null;
100-
$apkPackageName = isset($responseData['apk_package_name']) ? $responseData['apk_package_name'] : null;
98+
$hostname = isset($responseData['hostname']) ? $responseData['hostname'] : '';
99+
$challengeTs = isset($responseData['challenge_ts']) ? $responseData['challenge_ts'] : '';
100+
$apkPackageName = isset($responseData['apk_package_name']) ? $responseData['apk_package_name'] : '';
101101
$score = isset($responseData['score']) ? floatval($responseData['score']) : null;
102-
$action = isset($responseData['action']) ? $responseData['action'] : null;
102+
$action = isset($responseData['action']) ? $responseData['action'] : '';
103103

104104
if (isset($responseData['success']) && $responseData['success'] == true) {
105105
return new Response(true, array(), $hostname, $challengeTs, $apkPackageName, $score, $action);
@@ -123,7 +123,7 @@ public static function fromJson($json)
123123
* @param string $action
124124
* @param array $errorCodes
125125
*/
126-
public function __construct($success, array $errorCodes = array(), $hostname = null, $challengeTs = null, $apkPackageName = null, $score = null, $action = null)
126+
public function __construct($success, array $errorCodes = array(), $hostname = '', $challengeTs = '', $apkPackageName = '', $score = null, $action = '')
127127
{
128128
$this->success = $success;
129129
$this->hostname = $hostname;

0 commit comments

Comments
 (0)