WP_DEBUG Notice in plugin

Enabling WP_DEBUG gives the following notice from this plugin:

Notice: Undefined index: key in /kfuk-kfum-dev.fyrkantigt.se/wp-content/plugins/post-indexer/post-indexer.php on line 41

I think the easiest way to solve this is to change the offending code to:

//check for activating
if (isset($_GET['key'])) {
    if ($_GET['key'] == '' || $_GET['key'] === ''){
        add_action('admin_head', 'post_indexer_make_current');
    }
}
    Philip John

    Hiya,

    This is to be expected as the IF statement does check for the existence of the key. If the key isn't there, the contents of the IF won't run and that notice will be produced.

    Nothing to worry about.

    Phil

    Niklas
    • Elite
    • 338
    • #280

    PHP reports these for a reason: So bugs like these can be found and fixed. Perhaps I just want things done the right way, sorry…

    Niklas
    • Elite
    • 338
    • #280

    PHP reports these for a reason: So bugs like these can be found and fixed. Perhaps I just want things done the right way, sorry…

    Edit: My code solves the bug just fine.

    Mason

    Hiya,

    Just chiming in to say we've reported this to the developer. He's out for the weekend, but we'll take a look next week. I don't see any reason not to include isset here. Thanks again!

    DavidM

    Hi KFUK-KFUM,

    Thanks for your feedback and edit on this one. We've pinged the developer to have a look here, he'll be along just as soon as possible.

    Thanks,
    David

Join 372490 happy members

Get access to our entire collection of epic plugins, astonishing themes & genius support

Become a member