DARKF3D3 Posted October 13, 2015 Share Posted October 13, 2015 Recently I found a lot of line like this into my server error log: [Mon Oct 12 16:46:22 2015] [warn] [client 152.247.xxx.xxx] mod_fcgid: stderr: PHP Warning: Invalid argument supplied for foreach() in /var/www/xxxxxx/xxxxxxx.com/xxxxxxx/controllers/front/SearchController.php on line 98, referer: http://www.website.com This is the line 98 of the SearchController.php file: foreach ($search['result'] as &$product) Any idea on how to fix this? Link to comment Share on other sites More sharing options...
Nabbolo Posted April 2, 2016 Share Posted April 2, 2016 +1 Same error, same line (98). Running PS 1.6.0.6. If you found a solution please post it! Thank you :-) Link to comment Share on other sites More sharing options...
Deoorbel Posted October 7, 2016 Share Posted October 7, 2016 Somebody solution for this problem? Link to comment Share on other sites More sharing options...
rocky Posted October 8, 2016 Share Posted October 8, 2016 Make sure you have the if statement wrapped around the foreach: if (is_array($search['result'])) { foreach ($search['result'] as &$product) { $product['link'] .= (strpos($product['link'], '?') === false ? '?' : '&').'search_query='.urlencode($query).'&results='.(int)$search['total']; } } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now