The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

Keep getting warning error: Invalid argument supplied for foreach()

Highlighted
Visitor

Keep getting warning error: Invalid argument supplied for foreach()

For the sample API forms, are there entries that need to be made that aren't covered in the instructions? I keep getting the following error on forms in different lines on form pages: Warning: Invalid argument supplied for foreach()

13 REPLIES 13
Highlighted
Employee

Re: Keep getting warning error: Invalid argument supplied for foreach()

Hey Paige,

 

This issue was brought to my attention today and should be fixed as of now.  Please download again from our repository and the foreach warning should go away.

Ryan Davis
Quality Engineer
Highlighted
Occasional Participant

Re: Keep getting warning error: Invalid argument supplied for foreach()

I just downloaded the sample forms for php and I'm getting the same error. Any suggestions?

Highlighted
Employee

Re: Keep getting warning error: Invalid argument supplied for foreach()

Hey,

 

Did your download have the V2.zip or was it the original?  I just made an update to the file which does not report the warning back to me on my live or sandbox environment.

Ryan Davis
Quality Engineer
Highlighted
Occasional Participant

Re: Keep getting warning error: Invalid argument supplied for foreach()

The file name is PHP_Contact_For_msV2.zip.  

Highlighted
Employee

Re: Keep getting warning error: Invalid argument supplied for foreach()

Which part of the sample forms are you seeing this error? 

Ryan Davis
Quality Engineer
Highlighted
Occasional Visitor

Re: Keep getting warning error: Invalid argument supplied for foreach()

Was there any solution provided for this yet? - I am getting the same error - see below:

 

PHP Notice: Trying to get property of non-object in D:\wwwroot\e-conoair.com\www\SampleForms\cc_class.php on line 167 PHP Warning: Invalid argument supplied for foreach() in D:\wwwroot\e-conoair.com\www\SampleForms\cc_class.php on line 167

 

Here is the code it is referencing:

 

 foreach ($parsedReturn->link as $item) {
                $tmp = $item->Attributes();
                $nextUrl = '';     
                if ((string) $tmp->rel == 'next') {
                    $nextUrl = (string) $tmp->href;
                    $arrTmp = explode($this->login, $nextUrl);
                    $nextUrl = $arrTmp[1];
                    $call2 = $this->apiPath.$nextUrl;
                    break;
                  }

 

I also get the same error on the next foreach statement:

 

 foreach ($parsedReturn->entry as $item) {
                if ($this->contact_lists ){
                if (in_array((string) $item->title, $this->contact_lists)) {
                    $tmp = array();
                    $tmp['id'] = (string) $item->id;
                    $tmp['title'] = (string) $item->title;
                    $mailLists[] = $tmp;
                   }

Highlighted
Employee

Re: Keep getting warning error: Invalid argument supplied for foreach()

Hey Raul,

 

I just released a new version of the sample forms about two days ago.  Which version are you using and what are you doing with in the sample forms to get this warning.

 

 

Ryan Davis
Quality Engineer
Highlighted
Occasional Participant

Re: Keep getting warning error: Invalid argument supplied for foreach()

Hello,

 

I am getting this error:

 

Warning: Invalid argument supplied for foreach() in /home/mdutler/public_html/wp-content/themes/whiteboard/constantcontact/cc_class.php on line 167

Warning: Invalid argument supplied for foreach() in /home/mdutler/public_html/wp-content/themes/whiteboard/constantcontact/cc_class.php on line 179

 

On this web page:

 

http://thebatterzbox.com/

 

You can see the error.

 

I just updated the plugin from within WP and the versions are attached.

 

May I please get some assistance in getting this resolved?


woo.jpg
Highlighted
Occasional Participant

Re: Keep getting warning error: Invalid argument supplied for foreach()

Has any seen this? Maybe have a resolution?

Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured