Project

General

Profile

Actions

Bug #82667

closed

Passing a FAL file reference as data to the f:cObject view helper causes the creation of unwished fal-tempfiles in typo3temp/var/transient

Added by Kai Strecker over 6 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
-
Start date:
2017-10-04
Due date:
% Done:

0%

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

Description

We often do something like the following to generate images (image is a FAL object).

<f:cObject typoscriptObjectPath="lib.imageRenderer" data="{image}" />

We do this mainly to generate multiple versions with different resolutions, which then get chosen and loaded via javascript in the web browser.

But there is a problem:

  1. The CObjectViewHelper calls \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getGettableProperties($data).
  2. The getGettableProperties method finds the \TYPO3\CMS\Core\Resource\FileReference::getForLocalProcessing method and calls it to get the property.
  3. getForLocalProcessing has the parameter "writable" which is true by default and thus causes the creation of a fal-tempfile in the typo3temp/var/transient directory.

Those fal-tempfiles are always unwished (at least in our case), because lib.imageRenderer is a IMAGE cObject and thus creates the temp files on its own.

I think it's generally a bad idea, to create a fal-tempfile, if someone passes a FileReference to the CObjectViewHelper.

This problem also exists in TYPO3 v7.

Actions #1

Updated by Susanne Moog over 6 years ago

  • Category set to File Abstraction Layer (FAL)
Actions #2

Updated by Susanne Moog about 5 years ago

  • Status changed from New to Needs Feedback

Hey and thanks for the report, I analyzed the issue a bit further.

Basically when adding an object to the cObjectViewhelper it automatically calls every public get... method available regardless of whether that method is in fact a simple getter or does more intensive computing - as it's probably originally meant to be used with simple models where that actually makes sense.

As we need to keep things backwards-compatible and getForLocalProcessing is an interface method we can't easily change things there.

There are multiple ways to tackle the issue anyhow but all I found are a bit ugly:

- Convert {image} in your example to an array with only necessary properties yourself before handing it over to the CObjectViewhelper
- Check for FileReference class in cObjectViewhelper to handle that differently (which is ugly as it would potentially mean building exceptions for single class types all over)

Do you (or anyone) have a better idea that keeps backwards compatibility?

Actions #3

Updated by Kai Strecker about 5 years ago

Hi,

since I created the ticket, we always pass the uid of the image as the only parameter. In the TypoScript we then fetch the image using the FILES cObject.

Unfortunately I don't have a better idea that would keep backwards compatibility. So I guess we have to tolerate this little quirk, if nobody else has a good idea.

Actions #4

Updated by Susanne Moog about 4 years ago

  • Status changed from Needs Feedback to Closed

As nobody else had any idea I would recommend going with Kais workaround if this happens in your projects. Going to close the issue now - so we have it documented as quirky.

Actions

Also available in: Atom PDF