Bug #63086

Wrong count in format.crop ViewHelper

Added by Ludwig Rafelsberger almost 5 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Must have
Category:
-
Target version:
-
Start date:
2014-11-19
Due date:
% Done:

100%

TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

Description

When cropping text containing HTML tags the format.crop ViewHelper does respect HTML tags (given proper arguments of course) when counting input data towards maxCharacters argument.
The problem comes with HTML tags that contain attributes made of formerly unusual characters: E.g. dashes, as extensively used by HTML5 data-* attributes.

<f:format.crop maxCharacters="7"><em>Foo</em> bar baz lorem</f:format.crop>

will correctly yield Foo bar… whereas

<f:format.crop maxCharacters="7"><em data-foo="x">Foo</em> bar baz lorem</f:format.crop>

will not properly match the em tag and print something along <em data-…

Associated revisions

Revision 1b06d47e (diff)
Added by Ludwig Rafelsberger almost 5 years ago

[BUGFIX] Properly match html tags with data-* attributes

The cropHTML method needs to account for html tags - therefore it must
match them. The regex used for matching tags misses html tags with
attributes that contain dashes. (\w matches "any 'word' character",
being "[…] any letter or digit or the underscore character […]") [1].

The current W3C html draft sets even less constraints on what makes an
attribute name [2], but including dashes looks like the most urgent
need.

[1] http://php.net/manual/en/regexp.reference.escape.php
[2] http://www.w3.org/TR/html51/syntax.html#attributes-0

Resolves: #63086
Releases: master, 6.2
Change-Id: I52832ca3e8d9660faa939e673af6cdc32f310b18
Reviewed-on: http://review.typo3.org/34371
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>
Reviewed-by: Helmut Hummel <>
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>

Revision 77f7fa27 (diff)
Added by Ludwig Rafelsberger almost 5 years ago

[BUGFIX] Properly match html tags with data-* attributes

The cropHTML method needs to account for html tags - therefore it must
match them. The regex used for matching tags misses html tags with
attributes that contain dashes. (\w matches "any 'word' character",
being "[…] any letter or digit or the underscore character […]") [1].

The current W3C html draft sets even less constraints on what makes an
attribute name [2], but including dashes looks like the most urgent
need.

[1] http://php.net/manual/en/regexp.reference.escape.php
[2] http://www.w3.org/TR/html51/syntax.html#attributes-0

Resolves: #63086
Releases: master, 6.2
Change-Id: I52832ca3e8d9660faa939e673af6cdc32f310b18
Reviewed-on: http://review.typo3.org/34406
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>

History

#1 Updated by Gerrit Code Review almost 5 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/34371

#2 Updated by Gerrit Code Review almost 5 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/34371

#3 Updated by Gerrit Code Review almost 5 years ago

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

#4 Updated by Gerrit Code Review almost 5 years ago

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

#5 Updated by Gerrit Code Review almost 5 years ago

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

#6 Updated by Gerrit Code Review almost 5 years ago

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

#7 Updated by Gerrit Code Review almost 5 years ago

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

#8 Updated by Ludwig Rafelsberger almost 5 years ago

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

#9 Updated by Gerrit Code Review almost 5 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/34406

#10 Updated by Ludwig Rafelsberger almost 5 years ago

  • Status changed from Under Review to Resolved

#11 Updated by Benni Mack about 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF