Bug #39261
closedparseFunc does not handle nested tags correct
100%
Description
The _parseFunc function is not able to detect nested tags properly. The function is searching for the first closing tag, regardless other opening tags of the same type.
Test Code:
page.10 = TEXT page.10.value ( <ul> <li>first</li> <li>second <ul> <li>first sub</li> <li>second sub</li> </ul> </li> </ul> ) page.10.parseFunc { tags.li = TEXT tags.li.wrap = <li>LI:|</li> tags.li.current = 1 }
Expected:
<ul> <li>LI:first</li> <li>LI:second <ul> <li>LI:first sub</li> <li>LI:second sub</li> </ul> </li> </ul>
Actual result:
<ul> <li>LI:first</li> <li>LI:second <ul> <li>first sub</li> <li>LI:second sub</li> </ul> </li> </ul>
The relevant code in class.tslib_content.php -> _parseFunc($theValue, $conf):
// If we're inside a currentTag, just take it to the end of that tag! $tempContent = strtolower(substr($theValue, $pointer)); $len = strpos($tempContent, '</' . $currentTag[0]);
While parsing the content of "<li>second ...", the first closing tag which is found is the closing tag of "<li>first sub</li>". So, internal "<li>second<ul><li>first sub</li> is handled as one tag. On the end everything is concatinated in the correct order, so as long as you do not want to alter such an tag, you will not notice.
With this TypoScript, you get broken markup:
page.10.parseFunc { tags.li = TEXT tags.li.value = <li>Static</li> }
Result is:
<ul> <li>Static</li> <li>Static</li> <li>Static</li> </ul> </li> </ul>
Updated by Mathias Schreiber about 10 years ago
- Target version set to 7.2 (Frontend)
- Is Regression set to No
Updated by Benni Mack over 9 years ago
- Target version changed from 7.2 (Frontend) to 7.4 (Backend)
Updated by Susanne Moog over 9 years ago
- Target version changed from 7.4 (Backend) to 7.5
Updated by Benni Mack over 9 years ago
- Target version deleted (
7.5)
We need tests for that, so we can then easily fix it. Anyone up for the task? Just ping me.
Updated by Riccardo De Contardi about 7 years ago
This issue still affects 9.0.0-dev (latest master)
Updated by Gerrit Code Review about 6 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 https://review.typo3.org/58946
Updated by Gerrit Code Review about 6 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58946
Updated by Gerrit Code Review about 6 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58946
Updated by Gerrit Code Review over 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 https://review.typo3.org/c/Packages/TYPO3.CMS/+/58946
Updated by Gerrit Code Review over 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 https://review.typo3.org/c/Packages/TYPO3.CMS/+/58946
Updated by Gerrit Code Review about 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 https://review.typo3.org/c/Packages/TYPO3.CMS/+/58946
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 https://review.typo3.org/c/Packages/TYPO3.CMS/+/58946
Updated by Wolfgang Klinger almost 5 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 43d0fa1e78765ab1272f2f06d4a86a0c667ac538.
Updated by Benni Mack almost 5 years ago
- Status changed from Resolved to Closed
Updated by Christian Eßl almost 5 years ago
- Related to Bug #91172: html comments in fluid template lead to exception added
Updated by Oliver Hader almost 5 years ago
- Related to Bug #91194: Faulty follow-up tag detection in parseFunc & Co. (regression) added
Updated by Daniel Siepmann about 3 years ago
- Related to Bug #93012: Email address are not wrapped in A tag if config.spamProtectEmailAddresses is set added
Updated by Oliver Hader over 1 year ago
- Related to Bug #92194: ContentObjectRenderer wraps <img> tags in <p> tags added