[BUGFIX] cropHTML with dash in html element
authorJakub Cernek <development@cernek.cz>
Fri, 10 Jun 2011 20:52:00 +0000 (22:52 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 28 Apr 2012 14:53:04 +0000 (16:53 +0200)
Allow dash in regular expression of cropHTML function. It is needed
for recognition of W3C non-standard TYPO3 'link' element syntax.
(e.g. <link email@example.org - mail "Open email window">
email@example.org</link>)

Change-Id: I4bc8c5bfd196f80a3ee6d077ac6a760aa349486e
Fixes: #26915
Releases: 6.0, 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/10692
Reviewed-by: Stefan Neufeind
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
tests/typo3/sysext/cms/tslib/tslib_contentTest.php
typo3/sysext/cms/tslib/class.tslib_content.php

index 741efb8..29e0be5 100644 (file)
@@ -559,6 +559,9 @@ class tslib_contentTest extends tx_phpunit_testcase {
                                $charset . ' text with entities -59|...|1' => array(
                                        '-59|...|1', $textWithEntities, '...implemented the; original version of the crop function.', $charset
                                ),
+                               $charset . ' text with dash in html-element 28|...|1' => array(
+                                       '28|...|1', 'Some text with a link to <link email.address@example.org - mail "Open email window">my email.address@example.org</link> and text after it', 'Some text with a link to <link email.address@example.org - mail "Open email window">my...</link>', $charset
+                               ),
                        ));
                }
                return $data;
index 3c24f69..c078366 100644 (file)
@@ -3677,17 +3677,23 @@ class tslib_cObj {
                                </?(?:" . $tags . ")+                   # opening tag ('<tag') or closing tag ('</tag')
                                (?:
                                        (?:
-                                               \s+\w+                                  # EITHER spaces, followed by word characters (attribute names)
                                                (?:
-                                                       \s*=?\s*                        # equals
-                                                       (?>
-                                                               \".*?\"                 # attribute values in double-quotes
-                                                               |
-                                                               '.*?'                   # attribute values in single-quotes
-                                                               |
-                                                               [^'\">\s]+              # plain attribute values
-                                                       )
-                                               )?
+                                                       \s+\w+                          # EITHER spaces, followed by word characters (attribute names)
+                                                       (?:
+                                                               \s*=?\s*                # equals
+                                                               (?>
+                                                                       \".*?\"         # attribute values in double-quotes
+                                                                       |
+                                                                       '.*?'           # attribute values in single-quotes
+                                                                       |
+                                                                       [^'\">\s]+      # plain attribute values
+                                                               )
+                                                       )?
+                                               )
+                                               |                                               # OR a single dash (for TYPO3 link tag)
+                                               (?:
+                                                       \s+-
+                                               )
                                        )+\s*
                                        |                                                       # OR only spaces
                                        \s*