By keithmcd on
I get the following error whenever a search is performed on my site. It is displayed at the top of the page before anything else, but the results of the search are displayed where they should be. THis doesn't seem to make sense to me, but oh well - it is almost 3am so not much makes sense right now anyway.
Anyone else seen this or have a fix? I couldn't find anything like this in the forums already.
warning: Invalid argument supplied for foreach() in /hsphere/local/home/keithmcd/bleak1.keithmcd.com/includes/common.inc on line 703.
/**
* Perform a global search on the given keys, and return the formatted results.
*/
function search_data($keys = NULL) {
$edit = $_POST['edit'];
$output = '';
if (isset($keys)) {
foreach (module_list() as $name) {
if (module_hook($name, 'search') && (!$edit['type'] || $edit['type'][$name])) {
list($title, $results) = module_invoke($name, 'search', $keys);
if ($results) {
$output .= '<h2>'. $title .'</h2>';
$output .= '<dl class="search-results">';
foreach ($results as $entry) { <-- This is line 703
$output .= search_item($entry, $name);
}
$output .= '</dl>';
}
}
}
}
Comments
Bump
A bump this be. My site is now live (http://keithmcd.com) but I'm still getting this error. I tried commenting out a part that I thought might be causing it (as $entry) but that just caused a fatal error instead.
Any help, greatly appreciated.
Try this
Try replacing line 703 with:
--
If you have a problem, please search before posting a question.
Or better
Replace line 700:
with:
perfect
If I'd actually log in more I would have gotten this problem fixed a long time ago. the first fix stopped the fatal error but also produced a false search result. The second one worked perfect. Thanks!