Bug #88022

Arguments not passed or replaced in FileSize validator error message

Added by Jarvis H over 1 year ago. Updated over 1 year ago.

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

100%

Estimated time:
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 translatedClosed2018-11-29

Actions
#1

Updated by Jarvis H over 1 year ago

  • Description updated (diff)
#2

Updated by Jarvis H over 1 year ago

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

Updated by Jarvis H over 1 year ago

  • Priority changed from Should have to Must have
#4

Updated by Bjoern Jacob over 1 year ago

  • Sprint Focus set to Remote Sprint
#5

Updated by Gerrit Code Review over 1 year 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 over 1 year 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 over 1 year 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 over 1 year 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 over 1 year 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 over 1 year 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 over 1 year 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 over 1 year 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 over 1 year 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 over 1 year 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 over 1 year ago

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

Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF