Issue Bug Resolved

#110868HrefLangGenerator reuses one LanguageMenuProcessor, so addQueryString.exclude grows with every request in long-running workers

Nikita Hovratov 10/01/26, 08:21 updated 10/09/26, 19:25

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

  1. Run TYPO3 v14 with EXT:seo on a runtime that keeps the PHP process and DI container between requests.
  2. Request a frontend page (without no_index) more than 1,500 times on the same worker.
  3. The warning above appears, and the exclude list contains id once 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 LanguageMenuProcessor stateless between calls: build the menu config from the class defaults on each process() call instead of merging into the existing property. For example, keep the defaults in a separate property or a constant, and reset $menuConfig at the start of process().
  • Additionally or alternatively, don’t hold the processor (and the ContentObjectRenderer) as shared state in HrefLangGenerator. Create them per invocation, or mark HrefLangGenerator as shared: false.

Reviews 2

History 27

  1. Nikita Hovratov commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-10-09T16:55:09+00:00" > 10/09/26, 16:55 </span>

    Applied in changeset commit:18fdbd25ecdb7a243d9717f5c858d9cd3dc8e5f3.

  2. Gerrit Code Review pushed patch set 3 for 14.3 to change 96566 status Resolved Under Review <span data-processor="relativetime" data-value="2026-10-09T19:05:27+00:00" > 10/09/26, 19:05 </span>

  3. Nikita Hovratov commented and changed status Under Review Resolved <span data-processor="relativetime" data-value="2026-10-09T19:25:09+00:00" > 10/09/26, 19:25 </span>

    Applied in changeset commit:a6c71f05d3cb48c3df947c07bdec00ff8751c710.