diff --git a/cake/libs/view/helpers/html.php b/cake/libs/view/helpers/html.php
index 730889924..32c027690 100644
--- a/cake/libs/view/helpers/html.php
+++ b/cake/libs/view/helpers/html.php
@@ -525,6 +525,9 @@ class HtmlHelper extends AppHelper {
if ($escape) {
$text = h($text);
}
+ if (!is_array($attributes)) {
+ $attributes = array('class' => $attributes);
+ }
if ($text === null) {
$tag = 'tagstart';
} else {
diff --git a/cake/tests/cases/libs/view/helpers/html.test.php b/cake/tests/cases/libs/view/helpers/html.test.php
index fd12cc522..974d2a289 100644
--- a/cake/tests/cases/libs/view/helpers/html.test.php
+++ b/cake/tests/cases/libs/view/helpers/html.test.php
@@ -651,6 +651,9 @@ class HtmlHelperTest extends CakeTestCase {
$result = $this->Html->tag('div', '', array('class' => 'class-name'), true);
$this->assertTags($result, array('div' => array('class' => 'class-name'), '<text>', '/div'));
+
+ $result = $this->Html->tag('div', '', 'class-name', true);
+ $this->assertTags($result, array('div' => array('class' => 'class-name'), '<text>', '/div'));
}
function testDiv() {