Title: Undefined variable errors
Last modified: March 29, 2017

---

# Undefined variable errors

 *  [Summon Press](https://wordpress.org/support/users/summonpress/)
 * (@summonpress)
 * [9 years ago](https://wordpress.org/support/topic/undefined-variable-errors-2/)
 * 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](https://wordpress.org/support/users/addthis_matt/)
 * (@addthis_matt)
 * [9 years ago](https://wordpress.org/support/topic/undefined-variable-errors-2/#post-8969821)
 * 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.

 * ![](https://s.w.org/plugins/geopattern-icon/addthis-all_ffab73.svg)
 * [WordPress Website Tools Plugin – AddThis](https://wordpress.org/plugins/addthis-all/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/addthis-all/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/addthis-all/)
 * [Active Topics](https://wordpress.org/support/plugin/addthis-all/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/addthis-all/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/addthis-all/reviews/)

## Tags

 * [php-error](https://wordpress.org/support/topic-tag/php-error/)

 * 1 reply
 * 2 participants
 * Last reply from: [addthis_matt](https://wordpress.org/support/users/addthis_matt/)
 * Last activity: [9 years ago](https://wordpress.org/support/topic/undefined-variable-errors-2/#post-8969821)
 * Status: not resolved