diff --git a/system/Helpers/form_helper.php b/system/Helpers/form_helper.php index 4f21effbc568..66eec099917e 100644 --- a/system/Helpers/form_helper.php +++ b/system/Helpers/form_helper.php @@ -70,7 +70,13 @@ function form_open(string $action = '', $attributes = [], array $hidden = []): s $csrfId = $attributes['csrf_id']; unset($attributes['csrf_id']); } - + + if(is_array($attributes) && array_key_exists('enctype', $attributes)) + { + $enctype = trim($attributes['enctype']); + unset($attributes['enctype']); + } + $attributes = stringify_attributes($attributes); if (stripos($attributes, 'method=') === false) @@ -83,7 +89,7 @@ function form_open(string $action = '', $attributes = [], array $hidden = []): s $attributes .= ' accept-charset="' . strtolower($config->charset) . '"'; } - $form = '
\n"; + $form = '\n"; // Add CSRF field if enabled, but leave it out for GET requests and requests to external websites $before = Services::filters()->getFilters()['before']; diff --git a/tests/system/Helpers/FormHelperTest.php b/tests/system/Helpers/FormHelperTest.php index 4c97b0706233..8c6e246be175 100644 --- a/tests/system/Helpers/FormHelperTest.php +++ b/tests/system/Helpers/FormHelperTest.php @@ -225,7 +225,7 @@ public function testFormOpenMultipart() $Value = csrf_hash(); $Name = csrf_token(); $expected = << + EOH; @@ -233,7 +233,7 @@ public function testFormOpenMultipart() else { $expected = << + EOH; }