Project

General

Profile

Actions

Bug #69263

closed

format.crop ViewHelper breaks inside some tags

Added by Ludwig Rafelsberger over 8 years ago. Updated over 6 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 #1

Updated by Gerrit Code Review over 8 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 http://review.typo3.org/42841

Actions #2

Updated by Benni Mack over 8 years ago

  • Category changed from Frontend to Fluid
Actions #3

Updated by Benni Mack over 8 years ago

  • Target version changed from 7.5 to 7 LTS
Actions #4

Updated by Gerrit Code Review over 8 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42841

Actions #5

Updated by Gerrit Code Review over 8 years ago

Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/43995

Actions #6

Updated by Ludwig Rafelsberger over 8 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #7

Updated by Gerrit Code Review over 8 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/43996

Actions #8

Updated by Benni Mack over 8 years ago

  • Status changed from Under Review to Resolved
Actions #9

Updated by Riccardo De Contardi over 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF