Jump to content

PHP errors Help needed


KeithW

Recommended Posts

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

function streamshare_rewrite_rules(){
    $resortPro = ResortPro();
    $rules = $resortPro->ssml_routes_for_search_results_pages();
    foreach($rules as $page_s_id => $rule) {
        add_rewrite_rule(''.$rule.'/(.+)/?','index.php?page_id='.$page_s_id.'&stream_search=$matches[1]','top');
    }
}

Can anyone help me here

 

Regards

 

Keith

Link to comment
Share on other sites

This is what Ive put

Not sure if its right

function streamshare_rewrite_rules(){
    $resortPro = ResortPro();
    $rules = $resortPro->ssml_routes_for_search_results_pages();
		if(is_array($rules) || is_object($rules)){
	    foreach($rules as $page_s_id => $rule) {
	        add_rewrite_rule(''.$rule.'/(.+)/?','index.php?page_id='.$page_s_id.'&stream_search=$matches[1]','top');
	    }
	}
}

 

Link to comment
Share on other sites

The var dump showed "NULL" on white screen

So I assumed that the value isn't set so the foreach shouldn't be ran

But when the result is defined it should pass and complete the foreach

PS Im not a programmer, just starting out :-(

Keith

 

Link to comment
Share on other sites

So if your function isn't doing the loop, what purpose will it serve if it doesn't return some kind of answer?

Or as Barand already told you - why don't you find out why the function ISN'T finding an array result?  Could be a hidden problem.

Edited by ginerjm
"isn't" not 'is'
Link to comment
Share on other sites

Hi

The function calls up extra pages when the streamshare function is live

The visual side of the site has the function to browse these but its disabled at the vendor

The plugin connects to them via an API - so whilst the values aint defined its trying to parse them

 

Keith

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.