line 2295 of C:\devstack\www\tourBuilder\includes\

variable_get - Provide a default.. OR ELSE!!

Warning: Invalid argument supplied for foreach() in form_type_checkboxes_value() (line 2295 of ...\includes\

I got this error while trying to build a form. This might sound obvious to you but here's the situation:
In most cases (and every case before coming up with this situation) there's a 'default' value in the variable table so when you set a '#default_value' for a form element, you can easily use variable_get to pull the value from there. If there's nothing previously set and no default provided, variable_get returns null.

The problem is that some form elements - ie checkboxes - require an array to be returned... apparently even if it's empty.

Perhaps null values should be assumed by when null is provided... which means I've stumbled upon a possible bug (or at least a feature request).

Until then, make sure you provide an empty array when dealing with form elements that require them:

form['user_option_checkboxes'] = array(
'#type' => 'checkboxes',
'#options' => $option_array,
'#default_value' => variable_get('user_option_checkboxes', array()),