diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
index e5e43bf4312ed..7f9684c0de4df 100644
--- a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
+++ b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
@@ -319,9 +319,10 @@
{%- block widget_attributes -%}
id="{{ id }}" name="{{ full_name }}"
+ {%- if read_only %} readonly="readonly"{% endif -%}
{%- if disabled %} disabled="disabled"{% endif -%}
{%- if required %} required="required"{% endif -%}
- {%- for attrname, attrvalue in attr -%}
+ {%- for attrname, attrvalue in attr if 'readonly' != attrname -%}
{{- " " -}}
{%- if attrname in ['placeholder', 'title'] -%}
{{- attrname }}="{{ translation_domain is same as(false) ? attrvalue : attrvalue|trans({}, translation_domain) }}"
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/widget_attributes.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/widget_attributes.html.php
index 3fefa47c15c99..8e3e35e8342a3 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/widget_attributes.html.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/widget_attributes.html.php
@@ -1,6 +1,8 @@
-id="escape($id) ?>" name="escape($full_name) ?>" disabled="disabled"
+id="escape($id) ?>" name="escape($full_name) ?>" readonly="readonly"
+ disabled="disabled"
required="required"
$v): ?>
+
escape($k), $view->escape(false !== $translation_domain ? $view['translator']->trans($v, array(), $translation_domain) : $v)) ?>
diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json
index 60d4cdb37005c..6b7853b036b26 100644
--- a/src/Symfony/Bundle/FrameworkBundle/composer.json
+++ b/src/Symfony/Bundle/FrameworkBundle/composer.json
@@ -43,7 +43,7 @@
"symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0",
"symfony/polyfill-intl-icu": "~1.0",
"symfony/security": "~2.6|~3.0.0",
- "symfony/form": "~2.8",
+ "symfony/form": "^2.8.4",
"symfony/expression-language": "~2.6|~3.0.0",
"symfony/process": "~2.0,>=2.0.5|~3.0.0",
"symfony/validator": "~2.5|~3.0.0",
diff --git a/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php
index 2bfc9158874ac..bc235a5c4218e 100644
--- a/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php
@@ -2430,7 +2430,7 @@ public function testWidgetAttributes()
$html = $this->renderWidget($form->createView());
// compare plain HTML to check the whitespace
- $this->assertSame('', $html);
+ $this->assertSame('', $html);
}
public function testWidgetAttributeNameRepeatedIfTrue()
diff --git a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
index 9e2c38cc6906a..953555724af2f 100644
--- a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
@@ -2373,7 +2373,7 @@ public function testWidgetAttributes()
$html = $this->renderWidget($form->createView());
// compare plain HTML to check the whitespace
- $this->assertSame('', $html);
+ $this->assertSame('', $html);
}
public function testWidgetAttributeNameRepeatedIfTrue()