WordPress.org

Ready to get started?Download WordPress

Forums

Shareaholic | share buttons & related posts
[resolved] PHP error on blog post page - Notice: Undefined variable: fetch_url (4 posts)

  1. Probocop
    Member
    Posted 3 years ago #

    Hi,

    I have just installed the Sexybookmarks plugin, and while the icons DO appear under my blog post, above the post I get the following error

    Notice: Undefined variable: fetch_url in C:\path\to\root\wp-content\plugins\sexybookmarks\includes\public.php on line 331 
    
    Notice: Undefined variable: shortener in C:\path\to\root\wp-content\plugins\sexybookmarks\includes\public.php on line 175 
    
    Notice: Undefined variable: shortener in C:\path\to\root\wp-content\plugins\sexybookmarks\includes\public.php on line 176 
    
    Notice: Undefined variable: shortener in C:\path\to\root\wp-content\plugins\sexybookmarks\includes\public.php on line 177 
    
    Notice: Undefined index: bgimg-padding in C:\path\to\root\wp-content\plugins\sexybookmarks\includes\public.php on line 128 
    
    Notice: Undefined index: spriteimg in C:\path\to\root\wp-content\plugins\sexybookmarks\includes\public.php on line 133

    Any idea what could be causing this?

    Thanks

  2. s_ha_dum
    Member
    Posted 3 years ago #

    Sexybookmarks is using a variable before the variable is set. Without looking, I'd guess the plugin is doing something like this (at least this is how how I generated hundreds of these before I knew better):

    if ($fetch_url) {
        // do stuff
    }
    
    // or maybe this
    
    $anarray[] = $fetch_url;

    These work. The parser will read the unset variables as empty or false and basically get things right, but it is technically wrong. To avoid them you'd need to use isset or !empty like so:

    if (!empty($fetch_url)) {
        // do stuff
    }
    
    if (isset($fetch_url)) {
        $anarray[] = $fetch_url;
    }

    'Notices' are non-fatal. They don't break the script but do point to 'loose' coding practices. If you are seeing that on a production server, you should really turn off error reporting though.

  3. Probocop
    Member
    Posted 3 years ago #

    Thanks for your response.

    The site is currently just on the dev server, and I had error reporting showing all.

    As it's part of the un-modified plugin, I think i'll just ignore it.

    Thanks again,
    Dave

  4. Shareaholic
    Member
    Plugin Author

    Posted 3 years ago #

    Probocop, thanks for the heads up. The upcoming release of SB should rid of most of these warnings.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic