Issue Bug Resolved

#110200LanguageMenuProcessor calls unnecessary hasSubpages

Riny van Tiggelen 07/15/26, 13:48 updated 10/28/26, 18:35

Description

The inner workings of the LanguageMenuProcessor have been updated in v14 in this commit (for the better):
https://review.typo3.org/c/Packages/TYPO3.CMS/+/92385

Unfortunately this has one side effect, for only calculating/rendering the hreflangs the hasSubpages is always called:
https://git.typo3.org/typo3/typo3/-/blob/v14.3.5/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php?ref_type=tags#L1912

Which calls the expensive isSubmenu function:
https://git.typo3.org/typo3/typo3/-/blob/v14.3.5/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php?ref_type=tags#L1379-1452

If your current page has a lot of subpages (in our case 30.000+) this completely runs out of memory.

My opinion would be that the LanguageMenuProcessor does not need to know that a page has subpages, and this expensive call is not necessary, but the getMenuItems is also used for the MenuProcessor so it’s shared functionality.

Reviews 3

History 47

  1. Oliver Bartsch commented <span data-processor="relativetime" data-value="2026-10-19T20:55:09+00:00" > 10/19/26, 20:55 </span>

    Hey,

    thanks for the report and the analysis, I can confirm this.

    Since 14.1, the LanguageMenuProcessor builds its items through AbstractMenuContentObject::getMenuItems(), which calculates hasSubpages for every item by calling isSubMenu(). For a language menu, every item is the current page, so this check loads all subpages of the current page with all columns. On pages with a very large number of subpages that runs out of memory. Up to v13 this never happened for language menus: their items carry an explicit ITEM_STATE, so the IFSUB evaluation was always skipped.

    I will push a patch that skips the subpage check for language menus in getMenuItems(). hasSubpages is still part of the language menu items, but it is always 0 again, just like in v13. This also applies to a MenuProcessor configured with special = language. Regular menus are not affected.

    Cheers, Oli

  2. Oliver Bartsch commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-10-28T18:35:14+00:00" > 10/28/26, 18:35 </span>

    Applied in changeset commit:19ae37515ac6c153961445f0780633eebc033ae5.