#110868HrefLangGenerator reuses one LanguageMenuProcessor, so addQueryString.exclude grows with every request in long-running workers
Description
Problem
On long-running PHP processes (worker-mode runtimes, where the container stays alive between requests), the frontend eventually logs this warning:
Warning: parse_str(): Input variables exceeded 1500. To increase the limit change max_input_vars in php.ini. in typo3/cms-frontend/Classes/Typolink/PageLinkBuilder.php line 923 (PageLinkBuilder::getQueryArguments)
The addQueryString.exclude value passed to the link builder at that point is id,id,id,id,… with more than 1,500 entries.
Cause
LanguageMenuProcessor keeps its menu configuration in the instance property $menuConfig. Every call to prepareConfiguration() reads the existing addQueryString.exclude value from that property and adds the result of CanonicalizationUtility::getParamsToExcludeForCanonicalizedUrl() to it, which is at least id:
$this->menuConfig = array_merge($this->menuConfig, $this->processorConfiguration);
// ...
$this->menuConfig['addQueryString.']['exclude'] = implode(
',',
array_merge(
GeneralUtility::trimExplode(',', $this->menuConfig['addQueryString.']['exclude'] ?? '', true),
$paramsToExclude
)
);
So each process() call on the same instance adds one more id.
The service is registered with shared: false in EXT:frontend/Configuration/Services.yaml. However, EXT:seo’s HrefLangGenerator is a shared service (an event listener for ModifyHrefLangTagsEvent), and it gets one LanguageMenuProcessor through constructor injection:
public function __construct(
protected ContentObjectRenderer $cObj,
protected LanguageMenuProcessor $languageMenuProcessor,
) {}
HrefLangGenerator::__invoke() then calls $this->languageMenuProcessor->process(...) on that single instance for every page rendered.
With classic PHP-FPM this goes unnoticed, because each process handles only one request. When the container lives on between requests, the exclude list grows by one id per request. After about max_input_vars requests on a worker, parse_str() in PageLinkBuilder::getQueryArguments() hits the limit. Link generation also gets slower as the list grows.
Steps to reproduce
- Run TYPO3 v14 with EXT:seo on a runtime that keeps the PHP process and DI container between requests.
- Request a frontend page (without
no_index) more than 1,500 times on the same worker. - The warning above appears, and the exclude list contains
idonce per previous request.
Alternatively, without a worker runtime: fetch HrefLangGenerator from the container and dispatch ModifyHrefLangTagsEvent several times in one process. LanguageMenuProcessor::$menuConfig['addQueryString.']['exclude'] grows by one id with each dispatch.
Expected behaviour
LanguageMenuProcessor::process() gives the same result no matter how often it was called before on the same instance.
Possible fix
- Make
LanguageMenuProcessorstateless between calls: build the menu config from the class defaults on eachprocess()call instead of merging into the existing property. For example, keep the defaults in a separate property or a constant, and reset$menuConfigat the start ofprocess(). - Additionally or alternatively, don’t hold the processor (and the
ContentObjectRenderer) as shared state inHrefLangGenerator. Create them per invocation, or markHrefLangGeneratorasshared: false.
Reviews 2
History 27
-
Gerrit Code Review pushed patch set 1 for main to change 96254 status
NewUnder Review <span data-processor="relativetime" data-value="2026-10-01T09:25:20+00:00" > 10/01/26, 09:25 </span> -
Gerrit Code Review pushed patch set 2 for main to change 96254 <span data-processor="relativetime" data-value="2026-10-01T09:42:46+00:00" > 10/01/26, 09:42 </span>
-
Gerrit Code Review pushed patch set 1 for 14.3 to change 96566 <span data-processor="relativetime" data-value="2026-10-09T16:19:23+00:00" > 10/09/26, 16:19 </span>
-
Gerrit Code Review pushed patch set 2 for 14.3 to change 96566 <span data-processor="relativetime" data-value="2026-10-09T16:48:52+00:00" > 10/09/26, 16:48 </span>
-
Nikita Hovratov commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-10-09T16:55:09+00:00" > 10/09/26, 16:55 </span> -
Gerrit Code Review pushed patch set 3 for 14.3 to change 96566 status
ResolvedUnder Review <span data-processor="relativetime" data-value="2026-10-09T19:05:27+00:00" > 10/09/26, 19:05 </span> -
Nikita Hovratov commented and changed status
Under ReviewResolved <span data-processor="relativetime" data-value="2026-10-09T19:25:09+00:00" > 10/09/26, 19:25 </span>Applied in changeset commit:a6c71f05d3cb48c3df947c07bdec00ff8751c710.
Applied in changeset commit:18fdbd25ecdb7a243d9717f5c858d9cd3dc8e5f3.