Project

General

Profile

Actions

Bug #103800

open

Slide for CONTENT object does not work if last element is empty

Added by Robert Vock 12 days ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2024-05-07
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
13
PHP Version:
8.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

If you are using a CONTENT object with the slide = -1 setting, it's possible that the content of the current page and the content of the parent page are shown.

If the last element on the current page generates completly empty HTML, the if condition in ContentContentObject is wrong.

Steps to reproduce:

1. Install empty TYPO3
2. Create a root page with a text element
3. Create a subpage with a text element and an empty HTML element
4. Create TypoScript on the root page which includes fluid_styled_content and the following TypoScript


# Default PAGE object:
page = PAGE
page.10 = CONTENT
page.10.table = tt_content
page.10.slide = -1

tt_content.html >
tt_content.html = TEXT

5. Check the output of the subpage.

Result:

The element of the subpage and the element of the rootpage are shown

Expected Result:

Only the element of the subpage should be shown.

Bugfix

The bug is in this line:
https://github.com/TYPO3/typo3/blob/30399b0eb7d9b08b31f35e1e23cdcfb676ae6aff/typo3/sysext/frontend/Classes/ContentObject/ContentContentObject.php#L137


$tmpValue = $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
$cobjValue .= $tmpValue;
...
} while ($again && $slide && ((string)$tmpValue === '' && $slideCollectFuzzy || $slideCollect));

If the last cObj generates an empty string, tmpValue is empty and the while does not stop.
The while loop should check cobjValue.

The bug nearly exists since the beginning of Time ;-)
https://github.com/TYPO3/typo3/commit/dc716cca936f3749b0a1c381a1eb05e274b24c78
https://github.com/TYPO3/typo3/blob/dc716cca936f3749b0a1c381a1eb05e274b24c78/typo3/sysext/cms/tslib/class.tslib_content.php#L1196

No data to display

Actions

Also available in: Atom PDF