EllisLab/CodeIgniter — pull request #795 by Eclarian (2011-12-19 00:38:43+00:00)
Title: Make form open properly when empty array of parameters is passed

Even if $attributes passed to form_open() or form_open_multipart() is an empty array, it should still add the default method as post along with the default accept-charset.

I didn't do anything for the plain string attributes check as the form_open method already checks for the empty string and defaults the method to post. However, this does make one of these two blocks of code redundant.

// Within form_open()
// approximately line 59
if ($attributes == '')
{
$attributes = 'method="post"';
}

// Within _attributes_to_string()
// approximately line 985
if ($formtag == TRUE AND strpos($attributes, 'method=') === FALSE)
{
$attributes .= ' method="post"';
}

I think that the section within form_open() should be removed since it is already being called by form_open_multipart(), making the portion located within _attributes_to_string() required for that function but not ever for form_open()