Issue Bug Closed

#106696Base variants request context missing

Josua Vogel 05/14/25, 13:18 updated 06/12/25, 19:54

Description

According to the documentation (https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/SiteHandling/BaseVariants.html), all functions from DefaultFunctionsProvider.php can be used in the condition for baseVariants.

If you use the ip condition, e.g. ip(“devIp”), the call fails.

#1686745105 RuntimeException
Using expression language function “ip(devIp)” in a context without request.

Reviews 0

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

History 2

  1. Garvin Hicking commented and changed status New Closed <span data-processor="relativetime" data-value="2025-05-28T07:34:30+00:00" > 05/28/25, 07:34 </span>

    Thanks for the report! We discussed this and believe this to be a documentation issue, so I created this:

    https://github.com/TYPO3-Documentation/TYPO3CMS-Reference-CoreApi/pull/5670

  2. Stefan Froemken commented <span data-processor="relativetime" data-value="2025-06-12T19:54:37+00:00" > 06/12/25, 19:54 </span>

    I would prefer solving this issue on core side. Something like that:

    $this->expressionLanguageVariables = [
        'applicationContext' => (string)Environment::getContext(),
        'typo3' => $typo3,
        'date' => $context->getAspect('date'),
        'request' => new RequestWrapper($GLOBALS['TYPO3_REQUEST'] ?? null),
        'features' => $features,
    ];