Closed (won't fix)
Project:
Simplenews
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
13 Feb 2007 at 02:13 UTC
Updated:
31 Oct 2007 at 20:20 UTC
Invalid argument supplied for foreach() in C:\Program Files\Apache Group\Apache2\public_html\drupal-5.1\sites\all\modules\simplenews\simplenews.module on line 372.
simplenews_validate_taxonomy function assumes $taxonomy to be an array.
In the case I have - it isn't.
Have changed the code to the following.
function simplenews_validate_taxonomy($taxonomy) {
$vid = _simplenews_get_vid();
$result = db_query('SELECT tid FROM {term_data} WHERE vid = %d', $vid);
while ($tid = db_fetch_object($result)) {
$tids[] = $tid->tid;
}
$taxes = array();
# ADDED is_array()
if (is_array($taxonomy)) {
foreach ($taxonomy as $tax) {
$taxes[] = $tax;
}
} else {
$taxes[] = $taxonomy;
}
return array_intersect($tids, $taxes);
}
Comments
Comment #1
sutharsan commentedPlease describe your case. What modules have you activated that affect the taxonomy? Perhaps the cause of the problem is found there.
Comment #2
remy.honig commentedI got the same error. I suspect the category module to cause this error.
Comment #3
sutharsan commentedStatus?
Comment #4
holgerd commentedI had the same problem and the code provided above made the error message go away (when sending out the test e-mail).
Comment #5
sutharsan commentedThis could be a work-around, but if the problem is caused by Category module it should be solved by Category module.
See this issue for the status: http://drupal.org/node/115693