Support » Plugin: Shareaholic | share buttons, related posts, social analytics & more » PHP error on blog post page – Notice: Undefined variable: fetch_url

• Resolved Probocop

(@probocop)

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

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

(@apljdi)

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.

Probocop

(@probocop)

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

Plugin Author Shareaholic

(@shareaholic)

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

Viewing 3 replies - 1 through 3 (of 3 total)
• The topic ‘PHP error on blog post page – Notice: Undefined variable: fetch_url’ is closed to new replies.