Project

General

Profile

Actions

Bug #86878

closed

Missing typecast in UploadedFileReferenceConverter when importing FileReference

Added by Saskia Schreiber over 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Form Framework
Target version:
-
Start date:
2018-11-07
Due date:
% Done:

100%

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

Description

There seems to be a missing typecast in UploadedFileReferenceConverter->importUploadedResource() (https://github.com/TYPO3/TYPO3.CMS/blob/a36d3dab92aa48b7d415dbaced5ba69f8722f38c/typo3/sysext/form/Classes/Mvc/Property/TypeConverter/UploadedFileReferenceConverter.php#L222).

If there is a valid FileReference resourcePointer, $hashService->validateAndStripHmac is called which returns a string ID (f.ex. '23'). $this->createFileReferenceFromFalFileObject which is called next expects int as type, which leads to an exception.

In my local patch I fixed this with adding a typecast in line 221 ($resourcePointer = $resourcePointer ? (int)$resourcePointer : null;) if the resourcePointer is available.
Casting directly to int would lead to undesired casts from null to 0.

This bug may not cause any problems in direct usage, I found it while using the TypeConverter in combination with a custom extbase/fluid image upload.

Actions

Also available in: Atom PDF