Skip to content
This repository was archived by the owner on Nov 28, 2019. It is now read-only.

Commit 9fdbfed

Browse files
authored
Merge pull request #37 from Firesphere/patch-1
Read out the entire request instead of postVars()
2 parents 80a6645 + c7c453b commit 9fdbfed

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

code/RecaptchaField.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,14 @@ public function Field($properties = array())
158158
*/
159159
public function validate($validator)
160160
{
161-
/** @var array $request */
161+
/** @var array $postVars */
162162
if(SapphireTest::is_running_test()) {
163-
$request = $_REQUEST;
163+
$postVars = $_REQUEST;
164164
} else {
165-
$request = Controller::curr()->getRequest();
165+
$postVars = Controller::curr()->getRequest()->postVars();
166166
}
167167
// don't bother querying the recaptcha-service if fields were empty
168-
if (!array_key_exists('g-recaptcha-response', $request) || empty($request['g-recaptcha-response'])) {
168+
if (!array_key_exists('g-recaptcha-response', $postVars) || empty($postVars['g-recaptcha-response'])) {
169169
$validator->validationError(
170170
$this->name,
171171
_t(
@@ -181,7 +181,7 @@ public function validate($validator)
181181
return false;
182182
}
183183

184-
$response = $this->recaptchaHTTPPost($_REQUEST['g-recaptcha-response']);
184+
$response = $this->recaptchaHTTPPost($postVars['g-recaptcha-response']);
185185

186186
if (!$response) {
187187
$validator->validationError(

0 commit comments

Comments
 (0)