Project

General

Profile

Actions

Bug #88756

closed

TypoScript – Symfony Expressions: request.getQueryParams() should do an "is defined" validation

Added by Hagen Gebauer over 5 years ago. Updated over 1 year ago.

Status:
Rejected
Priority:
Should have
Assignee:
Category:
TypoScript
Target version:
-
Start date:
2019-07-15
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
symfony, expression,CodingNight
Complexity:
Is Regression:
Sprint Focus:

Description

[request.getQueryParams()['tx_news_pi1']['news'] > 0]
do something
[END]

This is working well – as long as the query parameter exists. If it doesn’t, the following error message will be written into the log file:
... {"expression":"request.getQueryParams()['tx_news_pi1']['news'] > 0","exception":"RuntimeException: Unable to get an item on a non-array. in ...

I have tried changing the condition as follows, hoping that it would be interpreted as “is defined” – but the results are exactly the same:
[request.getQueryParams()['tx_news_pi1']['news']]

In my view there should be an automated PHP isset() validation for such conditions. Or at least a way to actively check for is defined as you can do in Symfony’s Twig templating engine for example. I couldn’t find a similar way for TypoScript – please enlighten me if I just missed it.


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Task #89176: Provide better way to traverse array in TS conditionsClosedMarkus Klein2019-09-14

Actions
Is duplicate of TYPO3 Core - Bug #95781: PHP Warning: Undefined array key "uid" in /app/vendor/symfony/expression-language/Node/GetAttrNode.phpRejected2021-10-26

Actions
Actions

Also available in: Atom PDF