I had a developer add some code to display shops (author names) in the header menu of my theme.

It all worked fine in earlier versions of Wordpress (3.5.1.), but since updating to 3.5.2 (soon to be 3.6) and updating my theme. I am getting this error:

Warning: Invalid argument supplied for foreach() in....

Here is the code the error is relating to:
PHP Code:
function ik_print_shops() {
    global 
$wpdb;
    
$shop_list '';

    foreach (
$shop_data as $key => $shop ) :
        
$shop_letter substr(strtoupper($shop['shop']),0,1);
        if(
$key == || ($shop_letter $last && $key >= $last_index)) {
            
$last_index $key+$block_size-1;
            if (
$last_index $number_of_shops 1$last_index $number_of_shops 1;
            
$user2 $shop_data[$last_index];
            
$last substr(strtoupper($user2['shop']),0,1);
            
$block_count 0;
        }
        if(
$block_count == 0) {
            if(
$shop_letter <> $first$shop_list .=  '</ul></li>';
            
$shop_list .= '<li class=""><a class="ik_sub_list" href="#">'."Shops $shop_letter to $last</a>"// --- $key -> $last_index
            
$shop_list .= '<ul class="children">';
        }
           
$shop_list .=  '<li class="page-item"><a class="sf-with-ul" href="'.site_url().'/author/'.$shop['login'].'">' $shop['shop']. ' ('.$shop['adscount'].')'.'</a></li>';

           
$num++;
           
$block_count++;
    endforeach; 
// end the users loop.

    
$shop_list .=  '<li class="list-end"></li>';
    
$shop_list .=  '</ul></li>';
    
$shop_list .=  '</ul><! -- /ik-nav-shops -->';
    
$shop_list .= '</div><!-- /adv_shops -->';
    
$shop_list .=  '</li><! -- /shops_menu -->';
    
$shop_list .=  '</ul><! -- /menu sf-js-enabled -->';

    return 
$shop_list;
    }
}
add_shortcode'ik_menu_item_shops''ik_print_shops' ); 
Appreciate any help given

Thank you
Sarah