Issue Bug Rejected

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

Hagen Gebauer 07/15/19, 11:14 updated 04/12/23, 11:39

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.

Reviews 1