Issue Bug New Orphaned

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

Robert Vock 05/07/24, 12:21 updated 05/07/24, 12:21

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

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Fix this issue

Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch

Commit message
[BUGFIX] Slide for CONTENT object does not work if last element is empty Resolves: #103800 Releases: main