bschauer
bschauer

Reputation: 1010

Is inline notation of f:uri.image broken in typo3 8.3.0?

I use the TYPO3\CMS\Frontend\DataProcessing\FilesProcessor to access FAL Images

dataProcessing {
    20 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
    20 {
        references.fieldName = image
        as = images
    }
}

the use of<f:uri.image image="{images.0}" /> works fine but {f:uri.image(image:'{images.0}')} or {f:uri.image(image:images.0)}

gives me a FE Error:

#1: PHP Warning: htmlspecialchars() expects parameter 1 to be string, object given in typo3_cms8/vendor/typo3fluid/fluid/src/Core/Parser/SyntaxTree/EscapingNode.php line 41

Info: in 7.LTS the code works

Upvotes: 3

Views: 1238

Answers (1)

Claus Due
Claus Due

Reputation: 4271

This is caused by two things in combination:

  • The {images.0} variable is an object and has no __toString method
  • The parameter is passed wrapped in a TextNode in the provided inline example

To correct this problem avoid wrapping the object accessor in a text node:

{f:uri(image: images.0)}

For a much more detailed explanation about this you can view my video about the subject: Mastering Fluid - Accessing Variables.

I should also add that we are indeed aware of this edge case of variables which are incompatible with strings being wrapped in a TextNode. So far the decision is that we would rather allow this edge case to slip through and avoid adding a condition that would need to check every variable in every template which cumulative would be billions upon billions of conditions with the single goal of avoiding this warning.

Upvotes: 4

Related Questions