The MU forums have moved to WordPress.org

starting to get foreach errors (3 posts)

  1. Ovidiu
    Member
    Posted 15 years ago #

    after upgrading from debian sarge to etch, which included an upgrade to php 4.4.4-8 I started getting lots of foreach errors like this one:

    Warning: Invalid argument supplied for foreach() in /var/www/web23/web/wp-content/plugins/redirection/redirection.php on line 297

    any ideas or hints?

  2. ceejayoz
    Member
    Posted 15 years ago #

    One usually gets that when foreach() is being passed something that's not an array (or empty).

    Take a look at line 297 and surround the foreach() in a conditional - for example:

    
    if(is_array($array)) {
      foreach($array as $whatever) { ... }
    }
    

    is_array() should work, but I haven't checked... you could also use:

    
    if(count($array) > 0) {
      foreach($array as $whatever) { ... }
    }
    
  3. drmike
    Member
    Posted 15 years ago #

    What's the plugin?

About this Topic