Title: Warning printed
Last modified: August 21, 2016

---

# Warning printed

 *  Resolved [mallorydxw-old](https://wordpress.org/support/users/tomdxw/)
 * (@tomdxw)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/warning-printed/)
 * WordPress 3.7.1. Twitget 3.2.
 * With WP_DEBUG enabled and when the widget is added to a widget area but the plugin
   isn’t configured yet the following error occurs:
 * PHP Warning: Invalid argument supplied for foreach() in /var/vhosts/wp/wp-content/
   plugins/twitget/twitget.php on line 483
 * Tom Adams,
    dxw
 * [http://wordpress.org/plugins/twitget/](http://wordpress.org/plugins/twitget/)

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

 *  Anonymous User 9905372
 * (@anonymized-9905372)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/warning-printed/#post-4386499)
 * Will look into it ASAP, because it isn’t an issue that can crash the plugin.
 * Cheers and thanks for the notice.
 *  [dr_blue](https://wordpress.org/support/users/dr_blue/)
 * (@dr_blue)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/warning-printed/#post-4386631)
 * Hiya, having the same resulting E_WARNING but probably when no tweets could be
   loaded (API temporarily unavailable), the array $tweet_date_array will be empty
   and can’t be iterated with foreach, resulting in a E_WARNING.
 * This should fix it though:
 *     ```
       --- twitget_orig.php    2014-01-02 08:33:54.182842200 +0100
       +++ twitget_mod.php     2014-01-02 08:33:46.322842200 +0100
       @@ -480,7 +480,7 @@
                                       <?php
                                               }
                                       ?>
       -                               <?php foreach($tweet_date_array as $c => $val) { ?>
       +                               <?php if (!empty($tweet_date_array)) { foreach($tweet_date_array as $c => $val) { ?>
                                       var date_val_<?php echo $c; ?> = <?php echo $val; ?>;
                                       <?php if($options["show_relative_time"]) { ?>
                                       var date_<?php echo $c; ?> = moment.unix(date_val_<?php echo $c; ?>).fromNow();
       @@ -488,7 +488,7 @@
                                       var date_<?php echo $c; ?> = moment.unix(date_val_<?php echo $c; ?>).format("<?php echo $moment_js_time; ?>");
                                       <?php } ?>
                                       jQuery(".<?php echo $c; ?>_tweet_date").html(date_<?php echo $c; ?>);
       -                               <?php } ?>
       +                               <?php } } ?>
                               });
                       </script>
       ```
   
 * Couldn’t find the project on github so I was unable to submit this patch as a
   proposed bug-fix.
 *  Anonymous User 9905372
 * (@anonymized-9905372)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/warning-printed/#post-4386636)
 * Fixed in 3.3.
 * Cheers and thanks for the notice.

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

The topic ‘Warning printed’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/twitget.svg)
 * [Twitget](https://wordpress.org/plugins/twitget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/twitget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/twitget/)
 * [Active Topics](https://wordpress.org/support/plugin/twitget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/twitget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/twitget/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: Anonymous User 9905372
 * Last activity: [12 years, 4 months ago](https://wordpress.org/support/topic/warning-printed/#post-4386636)
 * Status: resolved