Bug Report
Affected File:
Classes/Domain/Validator/GoogleCaptchaValidator.php
TYPO3 Version:
12.x
Blog Extension Version:
13.x
Description
It seems that the if condition in GoogleCaptchaValidator might be logically incorrect, preventing the Google reCAPTCHA validation from ever running.
In my setup, I’m able to submit comments even when the reCAPTCHA checkbox is not checked.
Problematic Code
&& (!(bool)($requestData['action'] ?? null) && $requestData['action'] === $action)
&& (!(bool)($requestData['controller'] ?? null) && $requestData['controller'] === $controller)
In a typical scenario, the action is "form", which means:
$requestData['action'] ?? null returns "form"
(bool) "form" evaluates to true
!true is false
Therefore, this part of the condition is always false, even when $requestData['action'] === $action.
The same applies to controller.
Expected Behavior
The reCAPTCHA should be validated when the action and controller match the expected values.
Suggested Fix
Consider replacing the condition with something like:
(!isset($requestData['action']) || $requestData['action'] === $action)
Same logic for controller.
Let me know if I misunderstood the intended behavior. Thanks for maintaining the extension!
Bug Report
Affected File:
Classes/Domain/Validator/GoogleCaptchaValidator.phpTYPO3 Version:
12.x
Blog Extension Version:
13.x
Description
It seems that the
ifcondition inGoogleCaptchaValidatormight be logically incorrect, preventing the Google reCAPTCHA validation from ever running.In my setup, I’m able to submit comments even when the reCAPTCHA checkbox is not checked.
Problematic Code
In a typical scenario, the action is "form", which means:
$requestData['action'] ?? null returns "form"
(bool) "form" evaluates to true
!true is false
Therefore, this part of the condition is always false, even when $requestData['action'] === $action.
The same applies to controller.
Expected Behavior
The reCAPTCHA should be validated when the action and controller match the expected values.
Suggested Fix
Consider replacing the condition with something like:
(!isset($requestData['action']) || $requestData['action'] === $action)Same logic for controller.
Let me know if I misunderstood the intended behavior. Thanks for maintaining the extension!