Title: [Plugin: AddThis] PHP Warnings about array arguments in foreach() and array_shift()
Last modified: August 20, 2016

---

# [Plugin: AddThis] PHP Warnings about array arguments in foreach() and array_shift()

 *  [msenate](https://wordpress.org/support/users/msenate/)
 * (@msenate)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-addthis-php-warnings-about-array-arguments-in-foreach-and-array_shift/)
 * I’ve got a sub-domain multisite installation and am getting a few PHP warnings
   in my error log. The following error warns for lines 627, 633, 642, 647, and 
   666:
 * > PHP Warning: Invalid argument supplied for foreach() in wp-content/plugins/
   > addthis/addthis_social_widget.php on line 666, referer: [http://sub.site.com/blogname/wp-admin/](http://sub.site.com/blogname/wp-admin/)
 * Also, there’s an error around array_shift()’s parameters on line 658:
 * > PHP Warning: array_shift() expects parameter 1 to be array, null given in wp-
   > content/plugins/addthis/addthis_social_widget.php on line 658, referer: [http://sub.site.com/blogname/wp-admin/](http://sub.site.com/blogname/wp-admin/)
 * [http://wordpress.org/extend/plugins/addthis/](http://wordpress.org/extend/plugins/addthis/)

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

 *  [_mjk_](https://wordpress.org/support/users/_mjk_/)
 * (@_mjk_)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-addthis-php-warnings-about-array-arguments-in-foreach-and-array_shift/#post-2950670)
 * Hm, what version of PHP are you running?
 * Best,
    Matt
 *  Thread Starter [msenate](https://wordpress.org/support/users/msenate/)
 * (@msenate)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-addthis-php-warnings-about-array-arguments-in-foreach-and-array_shift/#post-2950673)
 * I’d rather not share the version number here, do you have any particular php 
   bugs in mind?
 * You can also contact me directly at msenate at plos {dot} org
 *  Plugin Contributor [addthis_paul](https://wordpress.org/support/users/addthis_paul/)
 * (@addthis_paul)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-addthis-php-warnings-about-array-arguments-in-foreach-and-array_shift/#post-2950674)
 * Are you using this as an admin user or some other permission level? We know of
   a bug that causes an error when you’re using the AddThis plugin and aren’t an
   admin user.
 *  Thread Starter [msenate](https://wordpress.org/support/users/msenate/)
 * (@msenate)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-addthis-php-warnings-about-array-arguments-in-foreach-and-array_shift/#post-2950675)
 * Hmm, I believe only admins and super admins are configuring the plugin. Might
   there be a configuration issue with super admins?
 *  Plugin Contributor [addthis_paul](https://wordpress.org/support/users/addthis_paul/)
 * (@addthis_paul)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-addthis-php-warnings-about-array-arguments-in-foreach-and-array_shift/#post-2950676)
 * No, it was only with users without admin rights having the problem.
 * Have you tried disabling other plugins to see if there’s a conflict?
 *  Thread Starter [msenate](https://wordpress.org/support/users/msenate/)
 * (@msenate)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-addthis-php-warnings-about-array-arguments-in-foreach-and-array_shift/#post-2950680)
 * I will test this, but it’s a rather odd error response for a plugin conflict.
   Thanks for your help thus far.
 *  Thread Starter [msenate](https://wordpress.org/support/users/msenate/)
 * (@msenate)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-addthis-php-warnings-about-array-arguments-in-foreach-and-array_shift/#post-2950691)
 * okay, I’ve debugged this further to the admin dashboard.
 * I believe it’s an issue with displaying the AddThis dashboard widget. I’ve disabled
   dashboard display in the advanced settings of AddThis and have not received any
   error messages.
 *  [_mjk_](https://wordpress.org/support/users/_mjk_/)
 * (@_mjk_)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-addthis-php-warnings-about-array-arguments-in-foreach-and-array_shift/#post-2950692)
 * It seems that the problem arises when a date range is selected (or defaulted)
   missing either share or clickback data. I’ve checked in a possible fix to the
   development version ([http://downloads.wordpress.org/plugin/addthis.zip](http://downloads.wordpress.org/plugin/addthis.zip)).
   Could you try that out and re-enable the dashboard widget to see if it works 
   it works for you?
 * Thanks!
 *  Thread Starter [msenate](https://wordpress.org/support/users/msenate/)
 * (@msenate)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-addthis-php-warnings-about-array-arguments-in-foreach-and-array_shift/#post-2950694)
 * thanks for the patch, it did not fix my problem, I continue to receive the same
   warning messages…
 *  [_mjk_](https://wordpress.org/support/users/_mjk_/)
 * (@_mjk_)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-addthis-php-warnings-about-array-arguments-in-foreach-and-array_shift/#post-2950696)
 * Man. There’s definitely something deeper going on that to fix properly will require
   adding some more powerful remote diagnostic capability to the tool.
 * However, I’ve updated the dev version with even more failsafes around missing
   data. Let me know if it resolves the problem at your leisure.

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

The topic ‘[Plugin: AddThis] PHP Warnings about array arguments in foreach() and
array_shift()’ is closed to new replies.

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

## Tags

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

 * 10 replies
 * 3 participants
 * Last reply from: [_mjk_](https://wordpress.org/support/users/_mjk_/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-addthis-php-warnings-about-array-arguments-in-foreach-and-array_shift/#post-2950696)
 * Status: not resolved