Bug #88022

Arguments not passed or replaced in FileSize validator error message

Added by Jarvis H 6 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Form Framework
Target version:
-
Start date:
2019-03-27
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:
Remote Sprint

Description

Description:

FileSize validation message shows with placeholders untouched, like so:
You must select a file that is larger than %s in size.

How to reproduce:

- Create a form with a file input field and add the FileSize validator to it.
- Submit form with file which does not pass file size validation.

Potential cause:

Validation rules for file uploads are handled differently than with other fields as they are called in typo3/sysext/form/Classes/Mvc/Property/TypeConverter/UploadedFileReferenceConverter.php in the method importUploadedResource to prevent file uploads which do not pass validation.

If a validation fails, the method throws a TypeConverterException which is caught and returned as a new error in this part of importUploadedResource->convertFrom:

try {
    $resource = $this->importUploadedResource($source, $configuration);
} catch (\Exception $e) {
    return $this->objectManager->get(Error::class, $e->getMessage(), $e->getCode());
}

First thing I noticed is that the error instance is of the class \TYPO3\CMS\Extbase\Error\Error and not \TYPO3\CMS\Extbase\Validation\Error like the errors for all other fields. I do not know if this poses a problem.

Second, the error is instantiated using only the error message and code, which means all values which should be passed to the "arguments" property of the error instance are lost, hence the untouched "%s" parts of the error string.


Related issues

Related to TYPO3 Core - Bug #87042: Single errors from FileSizeValidator could not be translated Closed 2018-11-29

Associated revisions

Revision 610aeca6 (diff)
Added by Michael Waack 5 months ago

[BUGFIX] Pass error arguments to translator

Resolves: #88022
Releases: master, 9.5
Change-Id: I7d86f8061d71357307d939d4c4359e9da1b2c68a
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60549
Tested-by: TYPO3com <>
Tested-by: Dominik Merkel <>
Tested-by: Mathias Brodala <>
Tested-by: Ralf Zimmermann <>
Reviewed-by: Dominik Merkel <>
Reviewed-by: Mathias Brodala <>
Reviewed-by: Björn Jacob <>
Reviewed-by: Ralf Zimmermann <>

Revision 0d055c87 (diff)
Added by Michael Waack 5 months ago

[BUGFIX] Pass error arguments to translator

Resolves: #88022
Releases: master, 9.5
Change-Id: I7d86f8061d71357307d939d4c4359e9da1b2c68a
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60591
Tested-by: TYPO3com <>
Tested-by: Ralf Zimmermann <>
Reviewed-by: Ralf Zimmermann <>

History

#1 Updated by Jarvis H 6 months ago

  • Description updated (diff)

#2 Updated by Jarvis H 6 months ago

  • Related to Bug #87042: Single errors from FileSizeValidator could not be translated added

#3 Updated by Jarvis H 6 months ago

  • Priority changed from Should have to Must have

#4 Updated by Bjoern Jacob 6 months ago

  • Sprint Focus set to Remote Sprint

#5 Updated by Gerrit Code Review 5 months ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60549

#6 Updated by Gerrit Code Review 5 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60549

#7 Updated by Gerrit Code Review 5 months ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60549

#8 Updated by Gerrit Code Review 5 months ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60549

#9 Updated by Gerrit Code Review 5 months ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60549

#10 Updated by Gerrit Code Review 5 months ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60549

#11 Updated by Gerrit Code Review 5 months ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60549

#12 Updated by Gerrit Code Review 5 months ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60549

#13 Updated by Gerrit Code Review 5 months ago

Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60549

#14 Updated by Gerrit Code Review 5 months ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60591

#15 Updated by Michael Waack 5 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#16 Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF