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

Possible Array Access warnings in Captcha Observer #4414

Closed
Hanmac opened this issue Dec 11, 2024 · 1 comment · Fixed by #4424
Closed

Possible Array Access warnings in Captcha Observer #4414

Hanmac opened this issue Dec 11, 2024 · 1 comment · Fixed by #4424

Comments

@Hanmac
Copy link
Contributor

Hanmac commented Dec 11, 2024

protected function _getCaptchaString($request, $formId)
{
$captchaParams = $request->getPost(Mage_Captcha_Helper_Data::INPUT_NAME_FIELD_VALUE);
return $captchaParams[$formId];
}

In this line, if for some reason the Post if empty, or it doesn't have the specific Key, it could throw different errors depending on if the whole Post is missing or just part of the key.

Like these:

Undefined array key $formId
Trying to access array offset on null

Should this be taken care of the function by adding ?? '' ?
If the String is empty, the Captcha Observer will deny access anyway.

@sreichel what is your opinion about this?

@sreichel
Copy link
Contributor

PR welcome :)

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

Successfully merging a pull request may close this issue.

2 participants