w3guy / No-CAPTCHA-reCAPTCHA-for-WooCommerce

Protect WooCommerce login and registration form againt spam using Google's No CAPTCHA reCAPTCHA.
1 stars 4 forks source link

Check if array index is defined #3

Closed chrisjimallen closed 5 years ago

chrisjimallen commented 5 years ago

The plugin currently generates a PHP notice about undefined index for 'captcha_wc_lost_password'. This fills up error logs and is untidy. This fixes that by checking to see if the 'captcha_wc_lost_password' index is defined first.

chrisjimallen commented 5 years ago

@collizo4sky Is there any chance of merging this or implementing a similar fix? Thank you.

w3guy commented 5 years ago

You are sure your fix actually fixes the issue?

chrisjimallen commented 5 years ago

It removes the notice about the array index if the array index doesn't exist.

isset() assumes the index exists before checking to see if its value is set. Doing the array_key_exists() first, prevents any unnecessary notices being generated.

Please test for yourself, it's really only this line.

w3guy commented 5 years ago

I have merged your PR. when next i have time, i will release the fix.

Thanks.