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

Open
Hanmac opened this issue Dec 11, 2024 · 0 comments
Open

Possible Array Access warnings in Captcha Observer #4414

Hanmac opened this issue Dec 11, 2024 · 0 comments

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?

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

No branches or pull requests

1 participant