Project

General

Profile

Actions

Bug #73156

closed

FrontendContentAdapterService concatenates multi-line fields by LF without replacing LFs before

Added by Daniel Neugebauer over 8 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2016-02-05
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

Description

FrontendContentAdapterService, used for compatibility with old field syntax, concatenates some fields (such as description => imagecaption) by line-feed (LF) characters to provide backwards-compatibility with old index-based splitting of combined fields as used before FAL introduction. As image captions have been changed to allow multi-line input with FAL, editors may now enter LF characters into image reference fields which results in shifted indices upon unsanitized concatenation.

As an example, imagine the following input in a content element with multiple images to the image Description fields:

  • Image 1: First description continues<LF>on the next line.
  • Image 2: This is image 2.
  • Image 3: Where's image 3?

This results in a concatenated string as follows:

First description continues
on the next line.
This is image 2.
Where's image 3?

On frontend, as splitting happens over LF (e.g. if CSC 4.5 is being used for output), this will render as:

+------------+        +------------+        +------------+
|  image 1   |        |  image 2   |        |  image 3   |
+------------+        +------------+        +------------+

First description     on the next line.     This is image 2.
continues

This issue can be fixed by replacing all editor-provided line-feed (LF) characters by carriage-return (CR):

First description continues<CR>on the next line.
This is image 2.
Where's image 3?

Resulting in:

+------------+        +------------+        +------------+
|  image 1   |        |  image 2   |        |  image 3   |
+------------+        +------------+        +------------+

First description     This is image 2.      Where's image 3?
continues
on the next line.

The patch provided for this issue first changes CRLF sequences to CR to avoid duplicating line breaks, then replaces all remaining single LFs to CR. Concatenation still happens over LF, requiring no changes to any other code. The HTML generated by CSC 4.5 remains valid:

  • single CRs are also recognized as line-breaks for image caption rendering and convert to BR tags
  • CRs in attributes are permitted syntax and will be either replaced by simple space characters if browsers can't handle them or they will show as an actual line-break (if used in e.g. title attributes)

As TYPO3 7 no longer provides FrontendContentAdapterService the patch only applies to 6.2.

Actions

Also available in: Atom PDF