Bug #86878

Missing typecast in UploadedFileReferenceConverter when importing FileReference

Added by Saskia Schreiber 9 days ago. Updated 9 days ago.

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

0%

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.

History

#1 Updated by Gerrit Code Review 9 days 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/58868

Also available in: Atom PDF