Project

General

Profile

Actions

Task #89176

closed

Provide better way to traverse array in TS conditions

Added by Markus Klein over 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Documentation
Target version:
-
Start date:
2019-09-14
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Sprint Focus:
On Location Sprint

Description

[request.getQueryParams()['my_ext']['foo'] > 0]

conditions like these cause errors if my_ext is not set or if foo is not set.

For the first case a dirty workaround is:

[request.getQueryParams() && request.getQueryParams()['my_ext'] && request.getQueryParams()['my_ext']['foo'] > 0]

which still crashes for the case when foo is not set.

My suggestion to solve this is:

[traverse(request.getQueryParams(), 'my_ext/foo') > 0]

Related issues 5 (0 open5 closed)

Related to TYPO3 Core - Bug #88756: TypoScript – Symfony Expressions: request.getQueryParams() should do an "is defined" validationRejectedFrank Nägler2019-07-15

Actions
Related to TYPO3 Core - Bug #88252: Route Results are not available via TypoScriptClosedBenni Mack2019-04-30

Actions
Related to TYPO3 Core - Bug #88928: routeEnhancers and GP conditions (TS) not workingClosed2019-08-07

Actions
Related to TYPO3 Core - Bug #90685: RST docs of symfony expression language for TypoScript conditions has a typoClosedMarkus Klein2020-03-09

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