projects
/
Packages
/
TYPO3.CMS.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[BUGFIX] Fix invalid type hints in EXT:form's file upload converter
[Packages/TYPO3.CMS.git]
/
typo3
/
sysext
/
form
/
Classes
/
Mvc
/
Property
/
TypeConverter
/
UploadedFileReferenceConverter.php
diff --git
a/typo3/sysext/form/Classes/Mvc/Property/TypeConverter/UploadedFileReferenceConverter.php
b/typo3/sysext/form/Classes/Mvc/Property/TypeConverter/UploadedFileReferenceConverter.php
index
f86c03b
..
567b7c2
100644
(file)
--- a/
typo3/sysext/form/Classes/Mvc/Property/TypeConverter/UploadedFileReferenceConverter.php
+++ b/
typo3/sysext/form/Classes/Mvc/Property/TypeConverter/UploadedFileReferenceConverter.php
@@
-132,11
+132,11
@@
class UploadedFileReferenceConverter extends AbstractTypeConverter
* Actually convert from $source to $targetType, taking into account the fully
* built $convertedChildProperties and $configuration.
*
* Actually convert from $source to $targetType, taking into account the fully
* built $convertedChildProperties and $configuration.
*
- * @param
string|int
$source
+ * @param
array
$source
* @param string $targetType
* @param array $convertedChildProperties
* @param PropertyMappingConfigurationInterface $configuration
* @param string $targetType
* @param array $convertedChildProperties
* @param PropertyMappingConfigurationInterface $configuration
- * @return AbstractFileFolder
+ * @return AbstractFileFolder
|Error|null
* @internal
*/
public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null)
* @internal
*/
public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null)
@@
-144,12
+144,17
@@
class UploadedFileReferenceConverter extends AbstractTypeConverter
if (!isset($source['error']) || $source['error'] === \UPLOAD_ERR_NO_FILE) {
if (isset($source['submittedFile']['resourcePointer'])) {
try {
if (!isset($source['error']) || $source['error'] === \UPLOAD_ERR_NO_FILE) {
if (isset($source['submittedFile']['resourcePointer'])) {
try {
+ // File references use numeric resource pointers, direct
+ // file relations are using "file:" prefix (e.g. "file:5")
$resourcePointer = $this->hashService->validateAndStripHmac($source['submittedFile']['resourcePointer']);
if (strpos($resourcePointer, 'file:') === 0) {
$resourcePointer = $this->hashService->validateAndStripHmac($source['submittedFile']['resourcePointer']);
if (strpos($resourcePointer, 'file:') === 0) {
- $fileUid = substr($resourcePointer, 5);
+ $fileUid =
(int)
substr($resourcePointer, 5);
return $this->createFileReferenceFromFalFileObject($this->resourceFactory->getFileObject($fileUid));
}
return $this->createFileReferenceFromFalFileObject($this->resourceFactory->getFileObject($fileUid));
}
- return $this->createFileReferenceFromFalFileReferenceObject($this->resourceFactory->getFileReferenceObject($resourcePointer), $resourcePointer);
+ return $this->createFileReferenceFromFalFileReferenceObject(
+ $this->resourceFactory->getFileReferenceObject($resourcePointer),
+ (int)$resourcePointer
+ );
} catch (\InvalidArgumentException $e) {
// Nothing to do. No file is uploaded and resource pointer is invalid. Discard!
}
} catch (\InvalidArgumentException $e) {
// Nothing to do. No file is uploaded and resource pointer is invalid. Discard!
}
@@
-240,6
+245,10
@@
class UploadedFileReferenceConverter extends AbstractTypeConverter
}
/**
}
/**
+ * In case no $resourcePointer is given a new file reference domain object
+ * will be returned. Otherwise the file reference is reconstituted from
+ * storage and will be updated(!) with the provided $falFileReference.
+ *
* @param CoreFileReference $falFileReference
* @param int $resourcePointer
* @return ExtbaseFileReference
* @param CoreFileReference $falFileReference
* @param int $resourcePointer
* @return ExtbaseFileReference