Project

General

Profile

Actions

Bug #89715

closed

Condition request.getNormalizedParams().getHttpHost() causes an error when cron runs schedular:run

Added by Markus Tröger about 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
TypoScript
Target version:
-
Start date:
2019-11-20
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I have a condition in the TypoScript like this:

[like(request.getNormalizedParams().getHttpHost(), "*.domain.com")]
    page.includeCSS.file99 = EXT:xskeleton/Resources/Public/Css/for-development-only.css
    page.includeJSFooter.file99 = EXT:xskeleton/Resources/Public/Js/for-development-only.js
[end]

This works totally fine in the frontend but when the schedular runs via cron the condition causes an error in the log file:

Tue, 19 Nov 2019 12:58:09 +0100 [ERROR] request="3d81e8292386f" component="TYPO3.CMS.Frontend.Configuration.TypoScript.ConditionMatching.ConditionMatcher": Unable to get a property on a non-object. - {"expression":"like(request.getNormalizedParams().getHttpHost(), \"*.domain.com\")","exception":"RuntimeException: Unable to get a property on a non-object. in /var/www/html/vendor/symfony/expression-language/Node/GetAttrNode.php:83

The problem is there is no request created within the schedular job. Therefore it turns out I can't use any of the conditions which based on a request. Isn't it a weird behaviour. I would expect the the condition just returns a FALSE.

Actions #1

Updated by Markus Tröger almost 5 years ago

I could solve the problem by myself.

When the schedular job is called there is no "normalizedParams" object in the request that caused the error. The simplest solution is to add an other condition for these normalizedParams. I modified the code to the following and it works:

[request.getNormalizedParams() && like(request.getNormalizedParams().getHttpHost(), "*.domain.com")]
    page.includeCSS.file99 = EXT:xskeleton/Resources/Public/Css/for-development-only.css
    page.includeJSFooter.file99 = EXT:xskeleton/Resources/Public/Js/for-development-only.js
[end]
Actions #2

Updated by Susanne Moog almost 5 years ago

  • Status changed from New to Closed

Closed as per previous comment (in general when using Frontend on the command line one needs to make sure all necessary setup is done.

Actions

Also available in: Atom PDF