The warning is caused by theme('select', $state_select) on line 165 of ec_store.inc.
It's possible that it's an issue with theme_select in form.inc.
http://api.drupal.org/api/function/theme_select/6

Adding empty #name, #id, and #value to the $state_select array [lines 147-155] gets rid of the warning.
If anyone has a better solution, please share it. Thank you.

CommentFileSizeAuthor
#1 ecommerce-859474.patch706 bytesSoren Jones

Comments

Soren Jones’s picture

StatusFileSize
new706 bytes
Soren Jones’s picture

Status: Needs review » Active

For reference, making the following changes in form.inc also stops the warning.

line 1418 of form.inc in function theme_select
Before
return theme('form_element', $element, '<select name="'. $element['#name'] .''. ($multiple ? '[]' : '') .'"'. ($multiple ? ' multiple="multiple" ' : '') . drupal_attributes($element['#attributes']) .' id="'. $element['#id'] .'" '. $size .'>'. form_select_options($element) .'</select>');

After
return theme('form_element', $element, '<select name="'. (isset($element['#name']) ? $element['#name'] : '') .''. ($multiple ? '[]' : '') .'"'. ($multiple ? ' multiple="multiple" ' : '') . drupal_attributes($element['#attributes']) .' id="'. (isset($element['#id']) ? $element['#id'] : '') .'" '. $size .'>'. form_select_options($element) .'</select>');

line 1428 of form.inc in function form_select_options
Before
$value_is_array = is_array($element['#value']);

After
$value_is_array = is_array(isset($element['#value']) ? $element['#value'] : FALSE);
$value_is_array = isset($element['#value']) ? is_array($element['#value']) : FALSE;

Soren Jones’s picture

Soren Jones’s picture

See #815032: Weird form api usage in ec_store.inc for an explanation of why $element[#name] etc. aren't set in the $state_select array.
Summary: To get Drupal to render a JS select element so the JS select element will inherit the same styling as the other select elements.

The solution to the above issue was to add the following line to the $state_select array:
'#parents' => array('state_select'),

gordon’s picture

Status: Active » Needs review

Loading patch up for testing.

gordon’s picture

Status: Active » Needs review

Committed to dev, thanks

Soren Jones’s picture

Gordon,

If you have time...

For reference, is there something that could be done differently in form.inc in (e.g.) Drupal 8?

I really like the way that you've done this.
I think the pattern(?) would be useful to people in general.

I'll mark this as fixed in 24 hours if you haven't.

Thank you.

Soren

gordon’s picture

Status: Needs review » Fixed
Soren Jones’s picture

Changing title back.

Status: Fixed » Closed (fixed)
Issue tags: -PHP 5.3 compatibility

Automatically closed -- issue fixed for 2 weeks with no activity.