• Resolved Howdy_McGee

    (@howdy_mcgee)


    Hello!

    I’m running the latest version of both WordPress and this plugin and our debug logs have been receiving many PHP notices regarding undefined indices:

    PHP Notice: Undefined index: HTTP_USER_AGENT in /httpdocs/wp-content/plugins/social-networks-auto-poster-facebook-twitter-g/inc/nxs_functions_wp.php on line 517

    The line in question is a big ole’ bot-check line as far as I can tell. I’d like to see it updated to test if HTTP_USER_AGENT exists first before jumping in the lengthy conditional:

    if( ! isset( $_SERVER['HTTP_USER_AGENT'] ) ) {
        return;
    }

    Or something similar to prevent these notices from cropping up.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author NextScripts

    (@nextscripts)

    Thanks for reporting. We will fix this in the next release

    Thread Starter Howdy_McGee

    (@howdy_mcgee)

    While I don’t think testing against empty() is going to be the same as checking against isset() since it is possible that HTTP_USER_AGENT may not even exist at all, my logs aren’t noticing any issues.

    Thanks for pushing out an update! I’ll mark the issue as resolved.

    Plugin Author NextScripts

    (@nextscripts)

    According to PHP itslef, empty() checks for existence as well.

    http://php.net/manual/en/function.empty.php

    Determine whether a variable is considered to be empty. A variable is considered empty if it does not exist or if its value equals FALSE. empty() does not generate a warning if the variable does not exist.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Undefined Index Notices’ is closed to new replies.