Bug #86878
closedMissing typecast in UploadedFileReferenceConverter when importing FileReference
100%
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.
Updated by Gerrit Code Review about 6 years 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
Updated by Gerrit Code Review about 6 years 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/58868
Updated by Gerrit Code Review about 6 years ago
Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58911
Updated by Georg Ringer about 6 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset c5f27f00dadf8d04727ef4a76abf620d94e1cd55.