Actions
Task #89176
closedProvide better way to traverse array in TS conditions
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]
Actions