![]() |
Invalid argument supplied for foreach() in Email.php - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html) +--- Thread: Invalid argument supplied for foreach() in Email.php (/thread-53062.html) Pages:
1
2
|
Invalid argument supplied for foreach() in Email.php - El Forum - 07-09-2012 [eluser]zoreli[/eluser] Hi I use CI 2.0.2 version I have a simple register form with 5 fields. When trying to register, form is submitted, but I get the following error. A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach() Filename: libraries/Email.php Line Number: 111 Error occurs when I try to send an e-mail to the new user, that just register. line 111 is Email.php is the following: foreach ($config as $key => $val) Anyone can point me to the solution of this problem? Regards,Zoreli Invalid argument supplied for foreach() in Email.php - El Forum - 07-09-2012 [eluser]skunkbad[/eluser] [quote author="zoreli" date="1341875441"]Hi I use CI 2.0.2 version I have a simple register form with 5 fields. When trying to register, form is submitted, but I get the following error. A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach() Filename: libraries/Email.php Line Number: 111 Error occurs when I try to send an e-mail to the new user, that just register. line 111 is Email.php is the following: foreach ($config as $key => $val) Anyone can point me to the solution of this problem? Regards,Zoreli [/quote] Are you extending the mail class? The email class by itself should never have this error. Invalid argument supplied for foreach() in Email.php - El Forum - 07-09-2012 [eluser]zoreli[/eluser] Hi skunkbad No, I am not extending it. I downnload the CI 2.1.2 and I replace that file, with the new one and I get the same error. The strange thing is that e-mail is sent successully....But why on earth am getting that error message remain a mystery for me. Regards,Zoreli Invalid argument supplied for foreach() in Email.php - El Forum - 07-09-2012 [eluser]Aken[/eluser] We need to know any relevant code, otherwise we're guessing. Invalid argument supplied for foreach() in Email.php - El Forum - 07-09-2012 [eluser]marjune[/eluser] first of all what is the value of the variable Code: $config Invalid argument supplied for foreach() in Email.php - El Forum - 07-09-2012 [eluser]skunkbad[/eluser] [quote author="marjune" date="1341897020"]first of all what is the value of the variable Code: $config This is a good point. If the email class is initialized with $config as anything but an array, the OP's error would be appropriate. Invalid argument supplied for foreach() in Email.php - El Forum - 07-11-2012 [eluser]zoreli[/eluser] Hi Sorry about the delay of responding on the main question here, the value of $config variable. using the print_r, the variable of the $config returns the following: Reply-To: my_valiehere.... Return-Path: my_value_here... From: my_value_herel... Hope this helps Invalid argument supplied for foreach() in Email.php - El Forum - 07-12-2012 [eluser]zoreli[/eluser] Shameless bump :cheese: Invalid argument supplied for foreach() in Email.php - El Forum - 07-12-2012 [eluser]InsiteFX[/eluser] This is telling me that you have not setup the $config array for the email class. CodeIgniter Users Guide - Email Class Invalid argument supplied for foreach() in Email.php - El Forum - 07-12-2012 [eluser]JoostV[/eluser] You have either loaded the email library like so Code: $this->load->library('email', $config); Code: $this->email->initialize($config); $config needs to be an array of on or more options to be set, for instance Code: $config = array('mailtype' => 'html'); Judging from the error you are passing a string, not an array. Options that can be set in $config can be found in the user guide. |