Help - Invalid argument supplied for foreach()

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 1
Joined: Tue Mar 12, 2019 1:19 pm

Tue Mar 12, 2019 1:22 pm

Hi All,

Im new to here, so a big HI to all

I have been pulling my hair out trying to remove some errors from a wordpress plugin, the vendor says its fine but when you end up with log files over 40MB and have to delete each few days I'm not convinced

From the many lines of my log file I have these

[12-Mar-2019 20:48:23 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/xxxxxxx/public_html/wp-content/plugins/streamline-core/resortpro.php on line 202

Line starting 199 to 205 of the addressed file

Code: Select all

function streamshare_rewrite_rules(){
    $resortPro = ResortPro();
    $rules = $resortPro->ssml_routes_for_search_results_pages();
    foreach($rules as $page_s_id => $rule) {

Can anyone help me here



User avatar
php-forum Fan User
php-forum Fan User
Posts: 839
Joined: Mon Feb 22, 2016 5:52 pm

Tue Mar 12, 2019 2:52 pm

It looks like $rules is not iterable (can't be used in a foreach loop)


Code: Select all

echo gettype ($rules);
to see what you've got.

Post Reply