When I try to import using the demo, I get this error

"warning: Invalid argument supplied for foreach() in .../includes/form.inc on line 948."

line 948:

----------------------------------------------------------------

/**
* Format a dropdown menu or scrolling selection box.
*
* @param $element
* An associative array containing the properties of the element.
* Properties used: title, value, options, description, extra, multiple, required
* @return
* A themed HTML string representing the form element.
*
* It is possible to group options together; to do this, change the format of
* $options to an associative array in which the keys are group labels, and the
* values are associative arrays in the normal $options format.
*/
function theme_select($element) {
$select = '';
$size = $element['#size'] ? ' size="' . $element['#size'] . '"' : '';
_form_set_class($element, array('form-select'));
$multiple = isset($element['#multiple']) && $element['#multiple'];
return theme('form_element', $element, '
'. form_select_options($element) .'

');
}

function form_select_options($element, $choices = NULL) {
if (!isset($choices)) {
$choices = $element['#options'];
}
// array_key_exists() accommodates the rare event where $element['#value'] is NULL.
// isset() fails in this situation.
$value_valid = isset($element['#value']) || array_key_exists('#value', $element);
$value_is_array = is_array($element['#value']);
$options = '';
foreach ($choices as $key => $choice) { *<-------------------------****this is line 948****
if (is_array($choice)) {
$options .= '';
$options .= form_select_options($element, $choice);
$options .= '';
}
elseif (is_object($choice)) {
$options .= form_select_options($element, $choice->option);
}
else {
$key = (string)$key;
if ($value_valid && (!$value_is_array && (string)$element['#value'] === $key || ($value_is_array && in_array($key, $element['#value'])))) {
$selected = ' selected="selected"';
}
else {
$selected = '';
}
$options .= ''. check_plain($choice) .'';
}
}
return $options;
}

-----------------------------------------------------

this error seems to happen with a few other modules as well, I can go thru them and find them if required.

I checked, and there seems to be no table in the sql database for import_html. is this a problem?

I am using drupal 5, on an ubuntu system running apache2, php5, mysql, and phpmyadmin.
I have the tidy binary insatlled, and there are no error reports there.
what could cause this error? I am new to drupal, and I LOVE IT. And while I can do a bit of BASIC html, I am still a bit confused on how to make static drupal pages, so this module is very attractive to me. Any help is appreciated!

Comments

dman’s picture

Status: Active » Closed (fixed)

I can't tell what caused that from this information.
The code you pasted is from the core library, so the problem started further up the chain.
This particular error however, I've seen happen when selectboxes are displayed with no options in them at all.
This is therefor probably not related directly to import html. ESPECIALLY if you see it elsewhere

my guess is you have a vocabulary assigned to pages, but no terms in that vocabulary.