webgrafia / ginger

Wordpress plugin to make website compliant with EU Cookie Policy, with opt-in feature
18 stars 7 forks source link

A lot of undefined indexes #9

Open melvinkoopmans opened 6 years ago

melvinkoopmans commented 6 years ago

There are a lot of array offsets not being checked for existence / not given a default value throughout the plugin. This results in a significant amount of unwanted PHP notices.

Me and my development team use the Whoops library for errors and we get a lot of error screens.

For instance in admin/partial/general.php:

<td colspan="2">
    <h2>
        <?php _e("Ginger is currently", "ginger"); ?>: 
        <b><?php if(is_array($options) && $options["enable_ginger"]) _e("enabled", "ginger"); else _e("disabled", "ginger");  ?></b> 
     </h2>
</td>

Here the offset enable_ginger is not always present. Resulting in an Undefined index: enable_ginger

Could you either check or provide a default variable so these notices will disappear? Maybe use something like XDebug, Whoops, Symfony Console etc. to walk through the notices.

There are several notices on:

Thanks in advance!