Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add timeout for the reCAPTCHA verification #219

Merged
merged 2 commits into from Jan 21, 2019
Merged

Add timeout for the reCAPTCHA verification #219

merged 2 commits into from Jan 21, 2019

Conversation

mgiraud
Copy link

@mgiraud mgiraud commented Jan 21, 2019

This PR allows the user set a timeout for the reCAPTCHA verification.
This is a way to fix the #143 issue.
It adds a new parameter timeout which can be a number > 0 or null by default.
The timeout param is added to the file_get_content only context if the timeout is not null
When the timeout is reached, a ContextErrorException is thrown

ContextErrorException {#6464 ▼
  -context: array:4 [▶]
  #message: "Warning: file_get_contents(https://www.google.com:81/recaptcha/api/siteverify): failed to open stream: Connection timed out"
  #code: 0
  #file: "/home/homes/m.giraudtelme/apps/mxm/vendor/excelwebzone/recaptcha-bundle/src/Extension/ReCaptcha/RequestMethod/Post.php"
  #line: 66
  #severity: E_WARNING
  trace: {▶}
}

The user can easily catch this exception.

@excelwebzone excelwebzone merged commit 0ab8775 into excelwebzone:master Jan 21, 2019
@mgiraud
Copy link
Author

mgiraud commented Jan 22, 2019

That was quick ! Thx ;D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants