Bug #26915

stdWrap.cropHTML does not recognize TYPO3 link attribute correctly (and removes text around)

Added by Jakub Černek almost 10 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Content Rendering
Target version:
-
Start date:
2011-05-19
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
4.4
PHP Version:
Tags:
Complexity:
medium
Is Regression:
Sprint Focus:

Description

Hi,
when the cropHTML try crop text inside TYPO3 link in longer form (e.g. <link - mail "Open email window"></link>), then all paragraph (or other tag with content) around this link is removed.
It can lead to remove all content.
Responsible is RegExp on line 4323 in typo3_src-4.4.7/typo3/sysext/cms/tslib/class.tslib_content.php
It doesn't handle dash and doublequote signs…


Files

26915.diff (510 Bytes) 26915.diff Fix Jakub Černek, 2011-05-20 01:38

Related issues

Related to TYPO3 Core - Bug #30005: stdWrap.cropHTML wrong on full-word crop shortly inside HTML-elementClosed2011-09-19

Actions
#1

Updated by Jakub Černek almost 10 years ago

Probably fixed. Testing and verification needed.
PCRE's sign \w doesn't contain a dash sign '-'. Doublequotes is not a problem.
May be it is a localy dependent.

#2

Updated by Mr. Hudson over 9 years ago

Patch set 2 of change Id7274fdab0be96a9118341a95dab82386d01c903 has been pushed to the review server.
It is available at http://review.typo3.org/2641

#3

Updated by Mr. Hudson over 9 years ago

Patch set 3 of change Id7274fdab0be96a9118341a95dab82386d01c903 has been pushed to the review server.
It is available at http://review.typo3.org/2641

#4

Updated by Philipp Gampe over 9 years ago

I can not reproduce either. Works fine for me with 5.3.6 (x86_64) on fedora.

#5

Updated by Jakub Černek over 9 years ago

OK, sorry for not proper description how to reproduce it.
My settings:
stdWrap.cropHTML = 82 | ... | 1
and text is not parsed by parsefunc.
Training text:
'Welcome
blah blah blah on email <link - mail "blah blah blah blah blah blah bl"></link> blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah'

Without fix it make "Welcome"
Proper break is somewhere "Welcomeblah blah blah on email blah blah blah blah"

#6

Updated by Helmut Hummel over 9 years ago

The question is: why do you use "cropHTML" to not actually crop HTML but the pseudo HTML content TYPO3 stores in the database?
To my understanding it's an abuse of that function which should not be "fixed".

#7

Updated by Stefan Neufeind over 9 years ago

Helmut, while in general I agree with you that it's not really "normal" HTML-content (and maybe not "the right weapon" to choose) I don't see why cropHTML needs to be overly restrictive. There might be a character like this minus in the string - but no browser or whatever would have a problem with that I expect since it would first search for the closing tag and be done with the general parsing. What the function currently does is fail "somewhere" in the middle of a tag which imho is "fully broken".

The word-characters (\w in this PCRE) don't include the minus-sign. But even if you say this pseudo-HTML is "artificial" and not really html, what if tomorrow somebody throws something like

<div letter-spacing="10px">

at it. Okay, that's not valid HTML and he/she made an error not to use the correct style-tag for it. But why should the crop-functionality fail on this one?

That having said: I'd favor for the function to be more open about "unexpected" characters and try to solve the job as easy as possible trying to find the closing tag and be done.

#8

Updated by Mr. Hudson over 9 years ago

Patch set 4 of change Id7274fdab0be96a9118341a95dab82386d01c903 has been pushed to the review server.
It is available at http://review.typo3.org/2641

#9

Updated by Mr. Hudson over 9 years ago

Patch set 5 of change Id7274fdab0be96a9118341a95dab82386d01c903 has been pushed to the review server.
It is available at http://review.typo3.org/2641

#10

Updated by Oliver Hader over 9 years ago

  • Status changed from New to Under Review
  • Complexity set to medium
#11

Updated by Mr. Hudson over 9 years ago

Patch set 6 of change Id7274fdab0be96a9118341a95dab82386d01c903 has been pushed to the review server.
It is available at http://review.typo3.org/2641

#12

Updated by Mr. Hudson over 9 years ago

Patch set 7 of change Id7274fdab0be96a9118341a95dab82386d01c903 has been pushed to the review server.
It is available at http://review.typo3.org/2641

#13

Updated by Chris topher over 9 years ago

  • Subject changed from stdWrap.cropHTML not recognize TYPO3 link attribute correctly (and remove text around) to stdWrap.cropHTML does not recognize TYPO3 link attribute correctly (and removes text around)
#14

Updated by Gerrit Code Review about 9 years ago

Patch set 8 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/2641

#15

Updated by Gerrit Code Review about 9 years ago

Patch set 9 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/2641

#16

Updated by Gerrit Code Review almost 9 years ago

Patch set 10 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/2641

#17

Updated by Gerrit Code Review almost 9 years ago

Patch set 1 for branch TYPO3_4-5 has been pushed to the review server.
It is available at http://review.typo3.org/10686

#18

Updated by Gerrit Code Review almost 9 years ago

Patch set 1 for branch TYPO3_4-6 has been pushed to the review server.
It is available at http://review.typo3.org/10687

#19

Updated by Gerrit Code Review almost 9 years ago

Patch set 1 for branch TYPO3_4-7 has been pushed to the review server.
It is available at http://review.typo3.org/10688

#20

Updated by Gerrit Code Review almost 9 years ago

Patch set 11 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/2641

#21

Updated by Gerrit Code Review almost 9 years ago

Patch set 2 for branch TYPO3_4-5 has been pushed to the review server.
It is available at http://review.typo3.org/10686

#22

Updated by Gerrit Code Review almost 9 years ago

Patch set 2 for branch TYPO3_4-6 has been pushed to the review server.
It is available at http://review.typo3.org/10687

#23

Updated by Gerrit Code Review almost 9 years ago

Patch set 2 for branch TYPO3_4-7 has been pushed to the review server.
It is available at http://review.typo3.org/10688

#24

Updated by Gerrit Code Review almost 9 years ago

Patch set 1 for branch TYPO3_4-7 has been pushed to the review server.
It is available at http://review.typo3.org/10690

#25

Updated by Gerrit Code Review almost 9 years ago

Patch set 1 for branch TYPO3_4-6 has been pushed to the review server.
It is available at http://review.typo3.org/10691

#26

Updated by Gerrit Code Review almost 9 years ago

Patch set 1 for branch TYPO3_4-5 has been pushed to the review server.
It is available at http://review.typo3.org/10692

#27

Updated by Jakub Černek almost 9 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 50 to 100
#28

Updated by Gerrit Code Review over 8 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch TYPO3_4-7 has been pushed to the review server.
It is available at http://review.typo3.org/13121

#29

Updated by Gerrit Code Review over 8 years ago

Patch set 1 for branch TYPO3_4-6 has been pushed to the review server.
It is available at http://review.typo3.org/13243

#30

Updated by Wouter Wolters over 8 years ago

All branches are updated. Please close this issue.

#31

Updated by Stefan Galinski over 8 years ago

  • Status changed from Under Review to Closed

Also available in: Atom PDF