Support » Plugin: WordPress Website Tools Plugin – AddThis » Undefined variable errors

  • Hello there

    We are using 3.0.0 version of the plugin, and we are getting a lot of these errors

    NOTICE: PHP message: PHP Notice:  Undefined variable: toolObject in wp-content/plugins/addthis-all/backend/AddThisPlugin.php on line 1433
    
    NOTICE: PHP message: PHP Notice:  Trying to get property of non-object in wp-content/plugins/addthis-all/backend/AddThisPlugin.php on line 1433

    Having a look at the file, we confirm the variable isn’t defined neither in the method nor in the class.

    Looking at the original code, we realize that the shortCode might come from the foreach variable rather than the object property

    foreach ($shortCodes as $shortCode => $callback) {
        if ($this->shortcodeExists($toolObject->shortCode)) {
            continue;
        }
        add_shortcode($shortCode, $callback);
    }

    We modified the code as follows

    foreach ($shortCodes as $shortCode => $callback) {
        if ($this->shortcodeExists($shortCode)) {
            continue;
        }
        add_shortcode($shortCode, $callback);
    }

    There are no more errors related to the undefined variable, but does it makes sense to you?

    PHP version is 5.4.16 and is run using FPM

    Thank you in advance

Viewing 1 replies (of 1 total)
  • Plugin Author addthis_matt

    (@addthis_matt)

    Hi there,

    Thanks for reaching out and for the preliminary investigation into what’s causing the notices!

    Those notices should only be appearing if PHP is setup in debug mode. We’ll investigate the cause of those notices further for a future release version.

    Thanks!

Viewing 1 replies (of 1 total)
  • The topic ‘Undefined variable errors’ is closed to new replies.