diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig
index ad5011082f50a..11e8f3f70b590 100644
--- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig
+++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig
@@ -114,7 +114,6 @@
{{- form_label(form) }} {# -#}
{{ form_widget(form, widget_attr) }} {# -#}
- {{ form_widget(form) }} {# -#}
{{ form_errors(form) }} {# -#}
{# -#}
{%- endblock form_row %}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
index 400f994d2f6f2..cf44257d34a51 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
@@ -68,7 +68,7 @@ public function testDebugDefaultDirectory()
/**
* @group legacy
* @expectedDeprecation Storing translations in the "%ssf_translation%s/Resources/translations" directory is deprecated since Symfony 4.2, use the "%ssf_translation%s/translations" directory instead.
- * @expectedDeprecation Storing templates in the "%ssf_translation%s/Resources/views" directory is deprecated since Symfony 4.2, use the "%ssf_translation%s/templates" directory instead.
+ * @expectedDeprecation Loading Twig templates from the "%ssf_translation%s/Resources/views" directory is deprecated since Symfony 4.2, use the "%ssf_translation%s/templates" directory instead.
*/
public function testDebugLegacyDefaultDirectory()
{
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php
index 3c0a38d1b05ee..087f5bf4b5a18 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php
@@ -199,11 +199,12 @@ public function requestHandlerProvider()
*/
public function testFailedFileUploadIsTurnedIntoFormErrorUsingHttpFoundationRequestHandler($errorCode, $expectedErrorMessage)
{
+ $requestHandler = new HttpFoundationRequestHandler();
$form = $this->factory
->createBuilder(static::TESTED_TYPE)
- ->setRequestHandler(new HttpFoundationRequestHandler())
+ ->setRequestHandler($requestHandler)
->getForm();
- $form->submit(new UploadedFile(__DIR__.'/../../../Fixtures/foo', 'foo', null, null, $errorCode, true));
+ $form->submit($this->createUploadedFile($requestHandler, __DIR__.'/../../../Fixtures/foo', 'foo', $errorCode));
if (UPLOAD_ERR_OK === $errorCode) {
$this->assertTrue($form->isValid());
@@ -243,15 +244,16 @@ public function testFailedFileUploadIsTurnedIntoFormErrorUsingNativeRequestHandl
*/
public function testMultipleSubmittedFailedFileUploadsAreTurnedIntoFormErrorUsingHttpFoundationRequestHandler($errorCode, $expectedErrorMessage)
{
+ $requestHandler = new HttpFoundationRequestHandler();
$form = $this->factory
->createBuilder(static::TESTED_TYPE, null, [
'multiple' => true,
])
- ->setRequestHandler(new HttpFoundationRequestHandler())
+ ->setRequestHandler($requestHandler)
->getForm();
$form->submit([
- new UploadedFile(__DIR__.'/../../../Fixtures/foo', 'foo', null, null, $errorCode, true),
- new UploadedFile(__DIR__.'/../../../Fixtures/foo', 'bar', null, null, $errorCode, true),
+ $this->createUploadedFile($requestHandler, __DIR__.'/../../../Fixtures/foo', 'foo', $errorCode),
+ $this->createUploadedFile($requestHandler, __DIR__.'/../../../Fixtures/foo', 'bar', $errorCode),
]);
if (UPLOAD_ERR_OK === $errorCode) {
@@ -316,15 +318,21 @@ public function uploadFileErrorCodes()
];
}
- private function createUploadedFile(RequestHandlerInterface $requestHandler, $path, $originalName)
+ private function createUploadedFile(RequestHandlerInterface $requestHandler, $path, $originalName, $errorCode = 0)
{
if ($requestHandler instanceof HttpFoundationRequestHandler) {
- return new UploadedFile($path, $originalName, null, null, true);
+ $class = new \ReflectionClass(UploadedFile::class);
+
+ if (5 === $class->getConstructor()->getNumberOfParameters()) {
+ return new UploadedFile($path, $originalName, null, $errorCode, true);
+ }
+
+ return new UploadedFile($path, $originalName, null, null, $errorCode, true);
}
return [
'name' => $originalName,
- 'error' => 0,
+ 'error' => $errorCode,
'type' => 'text/plain',
'tmp_name' => $path,
'size' => null,
diff --git a/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php b/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php
index 0e5389568e5ce..dc082505a1bb0 100644
--- a/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php
@@ -59,6 +59,12 @@ protected function getInvalidFile()
protected function getFailedUploadedFile($errorCode)
{
+ $class = new \ReflectionClass(UploadedFile::class);
+
+ if (5 === $class->getConstructor()->getNumberOfParameters()) {
+ return new UploadedFile(__DIR__.'/../../Fixtures/foo', 'foo', null, $errorCode, true);
+ }
+
return new UploadedFile(__DIR__.'/../../Fixtures/foo', 'foo', null, null, $errorCode, true);
}
}