Jump to content

PHP Warnings Invalid argument supplied for foreach() - please help


Recommended Posts

Hi, I'm getting these errors and I can't figure out what is wrong:

 

[02-Apr-2013 20:44:49 Europe/Warsaw] PHP Warning:  htmlentities() [<a href='function.htmlentities'>function.htmlentities</a>]: Invalid multibyte sequence in argument in /classes/Tools.php on line 498
[02-Apr-2013 20:44:49 Europe/Warsaw] PHP Warning:  htmlentities() [<a href='function.htmlentities'>function.htmlentities</a>]: Invalid multibyte sequence in argument in /tools/smarty/plugins/modifier.escape.php on line 30
[04-Apr-2013 10:26:02 Europe/Warsaw] PHP Warning:  Invalid argument supplied for foreach() in /controllers/SearchController.php on line 51

 

My files:

tools.php line 498:

return htmlentities($string, $type, 'utf-8');

 

modifier.escape.php line 30:

return htmlentities($string, ENT_QUOTES, $char_set);

 

SearchController.php line 51:

foreach ($searchResults AS &$product)

 

 

Can someone please help me with this?

Link to comment
Share on other sites

  • 2 weeks later...

You searched the web. Did you see this?:

http://stackoverflow...-sequence-error

 

Looks like you should either add "UTF-8" or update your PHP. Makes me wonder how you got that error and whether other people have it too.

 

Thanks for the reply but as it says on stackoverflow:

 

Specify the character set using
htmlentities($string, (whatever), "UTF-8");

 

You can see that in my tools.php

return htmlentities($string, $type, 'utf-8');

So I'm guessing it's ok or should I change the ' to " ?

 

And this does not apply to

PHP Warning:  Invalid argument supplied for foreach() in /controllers/SearchController.php on line 51

Link to comment
Share on other sites

Can you provide the basic information?:

- what version of PS are you using?

- when does the problem happen? Front Office or Back Office? And what are you trying to do at that moment?

- is this a new problem? Did it work before? Did you change anything recently?

Link to comment
Share on other sites

my PS version is 1.4.4.1

the problem occurs when you try to search for something in FO.

I don't really know if it is new, but I've discovered it reccently because I've added an error reporting command to php.ini.

 

As you can see below it happens quite often:

[17-Apr-2013 11:10:13 Europe/Warsaw] PHP Warning:  htmlentities() [<a href='function.htmlentities'>function.htmlentities</a>]: Invalid multibyte sequence in argument in /classes/Tools.php on line 498
[17-Apr-2013 11:10:13 Europe/Warsaw] PHP Warning:  htmlentities() [<a href='function.htmlentities'>function.htmlentities</a>]: Invalid multibyte sequence in argument in /classes/Tools.php on line 498
[17-Apr-2013 11:10:13 Europe/Warsaw] PHP Warning:  htmlentities() [<a href='function.htmlentities'>function.htmlentities</a>]: Invalid multibyte sequence in argument in /tools/smarty/plugins/modifier.escape.php on line 30
[17-Apr-2013 11:10:13 Europe/Warsaw] PHP Warning:  htmlentities() [<a href='function.htmlentities'>function.htmlentities</a>]: Invalid multibyte sequence in argument in /tools/smarty/plugins/modifier.escape.php on line 30
[17-Apr-2013 11:10:13 Europe/Warsaw] PHP Warning:  htmlentities() [<a href='function.htmlentities'>function.htmlentities</a>]: Invalid multibyte sequence in argument in /classes/Tools.php on line 498
[17-Apr-2013 11:10:13 Europe/Warsaw] PHP Warning:  htmlentities() [<a href='function.htmlentities'>function.htmlentities</a>]: Invalid multibyte sequence in argument in /tools/smarty/plugins/modifier.escape.php on line 30
[17-Apr-2013 11:10:13 Europe/Warsaw] PHP Warning:  htmlentities() [<a href='function.htmlentities'>function.htmlentities</a>]: Invalid multibyte sequence in argument in /classes/Tools.php on line 498
[17-Apr-2013 11:10:13 Europe/Warsaw] PHP Warning:  htmlentities() [<a href='function.htmlentities'>function.htmlentities</a>]: Invalid multibyte sequence in argument in /tools/smarty/plugins/modifier.escape.php on line 30
[17-Apr-2013 11:10:13 Europe/Warsaw] PHP Warning:  htmlentities() [<a href='function.htmlentities'>function.htmlentities</a>]: Invalid multibyte sequence in argument in /classes/Tools.php on line 498
[17-Apr-2013 11:10:13 Europe/Warsaw] PHP Warning:  htmlentities() [<a href='function.htmlentities'>function.htmlentities</a>]: Invalid multibyte sequence in argument in /tools/smarty/plugins/modifier.escape.php on line 30
[17-Apr-2013 11:10:13 Europe/Warsaw] PHP Warning:  htmlentities() [<a href='function.htmlentities'>function.htmlentities</a>]: Invalid multibyte sequence in argument in /classes/Tools.php on line 498
[17-Apr-2013 11:10:13 Europe/Warsaw] PHP Warning:  htmlentities() [<a href='function.htmlentities'>function.htmlentities</a>]: Invalid multibyte sequence in argument in /tools/smarty/plugins/modifier.escape.php on line 30
[17-Apr-2013 11:10:13 Europe/Warsaw] PHP Warning:  htmlentities() [<a href='function.htmlentities'>function.htmlentities</a>]: Invalid multibyte sequence in argument in /classes/Tools.php on line 498
[17-Apr-2013 11:10:13 Europe/Warsaw] PHP Warning:  htmlentities() [<a href='function.htmlentities'>function.htmlentities</a>]: Invalid multibyte sequence in argument in /tools/smarty/plugins/modifier.escape.php on line 30
[17-Apr-2013 11:10:14 Europe/Warsaw] PHP Warning:  htmlentities() [<a href='function.htmlentities'>function.htmlentities</a>]: Invalid multibyte sequence in argument in /classes/Tools.php on line 498
[17-Apr-2013 11:10:14 Europe/Warsaw] PHP Warning:  htmlentities() [<a href='function.htmlentities'>function.htmlentities</a>]: Invalid multibyte sequence in argument in /tools/smarty/plugins/modifier.escape.php on line 30
[17-Apr-2013 11:10:14 Europe/Warsaw] PHP Warning:  Invalid argument supplied for foreach() in /controllers/SearchController.php on line 50
[17-Apr-2013 11:28:45 Europe/Warsaw] PHP Warning:  Invalid argument supplied for foreach() in /controllers/SearchController.php on line 51
[17-Apr-2013 11:30:56 Europe/Warsaw] PHP Warning:  Invalid argument supplied for foreach() in /controllers/SearchController.php on line 51
[17-Apr-2013 11:31:08 Europe/Warsaw] PHP Warning:  Invalid argument supplied for foreach() in /controllers/SearchController.php on line 51
[17-Apr-2013 11:31:10 Europe/Warsaw] PHP Warning:  Invalid argument supplied for foreach() in /controllers/SearchController.php on line 51
[17-Apr-2013 11:31:14 Europe/Warsaw] PHP Warning:  Invalid argument supplied for foreach() in /controllers/SearchController.php on line 51
[17-Apr-2013 11:31:19 Europe/Warsaw] PHP Warning:  Invalid argument supplied for foreach() in /controllers/SearchController.php on line 51
[17-Apr-2013 11:31:22 Europe/Warsaw] PHP Warning:  Invalid argument supplied for foreach() in /controllers/SearchController.php on line 51
[17-Apr-2013 11:36:49 Europe/Warsaw] PHP Warning:  Invalid argument supplied for foreach() in /controllers/SearchController.php on line 51
[17-Apr-2013 12:11:12 Europe/Warsaw] PHP Warning:  Invalid argument supplied for foreach() in /controllers/SearchController.php on line 51
[17-Apr-2013 12:54:06 Europe/Warsaw] PHP Warning:  Invalid argument supplied for foreach() in /controllers/SearchController.php on line 51
[17-Apr-2013 12:54:10 Europe/Warsaw] PHP Warning:  Invalid argument supplied for foreach() in /controllers/SearchController.php on line 51
[17-Apr-2013 12:54:16 Europe/Warsaw] PHP Warning:  Invalid argument supplied for foreach() in /controllers/SearchController.php on line 51
[17-Apr-2013 15:27:15 Europe/Warsaw] PHP Warning:  Invalid argument supplied for foreach() in /controllers/SearchController.php on line 51
[17-Apr-2013 15:27:17 Europe/Warsaw] PHP Warning:  Invalid argument supplied for foreach() in /controllers/SearchController.php on line 51
[17-Apr-2013 15:30:45 Europe/Warsaw] PHP Warning:  Invalid argument supplied for foreach() in /controllers/SearchController.php on line 51
[17-Apr-2013 15:30:46 Europe/Warsaw] PHP Warning:  Invalid argument supplied for foreach() in /controllers/SearchController.php on line 51

Link to comment
Share on other sites

are you moving your prestashop to another server? In my experience i know that when you copy prestashop you must compress all files because presta loves to lose some data if you don't do that.

 

compress your old presta 1.4.4.1 and unpack it where you want. If my answer doesn't solve your problem give me more information about your installation.. good luck /pozdrawiam ^_^

Edited by Epredator (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...