Project

General

Profile

Actions

Bug #69263

closed

format.crop ViewHelper breaks inside some tags

Added by Ludwig Rafelsberger about 9 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Must have
Category:
Fluid
Target version:
Start date:
2015-08-22
Due date:
% Done:

100%

Estimated time:
0.50 h
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
medium
Is Regression:
No
Sprint Focus:

Description

The Regex used inside \TYPO3\CMS\Frontent\ContentObject\ContentObjectRenderer->cropHTML() uses a list of known html tags to do its work. Said list misses a lot of html5 tags. Furthermore, it does not respect <script> tags (as a @todo comment says).

How to reproduce: (constructing a bad outcome of this bug)

Steps

  • Use a Fluid template containing this:
    {someRteContent -> f:format.html() -> f:format.crop(maxCharacters: 25)}
  • allow iframe tags in the RTE configuration
    (I know, I know, bad…. But: even default, "good" tags like article are broken)
  • have an Editor place an iframe tag at the affected crop position
    Lets assume, the editor embeds a YouTube video there:
      <h1>Big buck bunny</h1>
      <iframe width="560" height="315" src="https://www.youtube.com/embed/YE7VzlLtp-4" frameborder="0" allowfullscreen></iframe>
      <p>Lorem ipsum dolor foo bar</p>

Expected result

  <h1>Big buck bunny</h1>
  <iframe width="560" height="315" src="https://www.youtube.com/embed/YE7VzlLtp-4" frameborder="0" allowfullscreen></iframe>
  <p>Lorem ipsum...</p>

Actual result

  <h1>Big buck bunny</h1>
  <iframe w...

This is obviously invalid html, effectively "hiding" any later output (using typical rendering engines).
Actions

Also available in: Atom PDF