Project

General

Profile

Actions

Bug #88368

closed

Invalid ts constants in symfony expression functions throw no exception in strict syntax mode

Added by Christian Eßl over 5 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2019-05-16
Due date:
% Done:

0%

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

Description

If I use a symfony expression condition and try to use a ts constant that does not exist, the condition is never executed.

Example:

[loginUser({$foo.nonExistingProperty})]
// this is never executed
[end]

After debugging in TYPO3\CMS\Core\ExpressionLanguage\Resolver::evalue() I found out, that because the ts constant couldn't be resolved, the expression language still got {$foo.nonExistingProperty} as a parameter and threw a SyntaxError that is silently caught.

Strict syntax mode for typoscript is enabled in the feature toggles and I checked the code AbstractConditionMatcher class. - There is some error handling, that is supposed to throw a InvalidTypoScriptConditionException in "strict mode" for some conditions like [1 in "foo"] or ["bar" in "foo,baz"]. In my example case, where the syntax error is a parameter inside a function like loginUser, the syntax error exception remains silent and the condition is just ignored. So I suppose this is a bug?

Actions #1

Updated by Susanne Moog over 5 years ago

It's actually behaving like it's documented in the code - it's throwing the exception only for invalid conditions that would otherwise produce a php warning, but not on SyntaxErrors - however, I'd argue that at least in v10 we should remove the different exception/error handling ways and treat the syntaxError same as other errors.

In v9 the error should be logged to var/log (or however it is configured).

Actions #2

Updated by Frank Nägler about 5 years ago

  • Status changed from New to Needs Feedback

the behavior is correct, the constant/variable {$foo.nonExistingProperty} will result in an empty value, because it could not be resolved.
The result is a call like loginUser() which ist valid an will return false.

I opt for closing this issue.

Actions #3

Updated by Christian Eßl about 5 years ago

Okay, can be closed!

Actions #4

Updated by Riccardo De Contardi about 5 years ago

  • Status changed from Needs Feedback to Closed

@Christian Eßl closing it; if I have misunderstood you, please reopen it or ping me and I'll do.

Best regards.

Actions

Also available in: Atom PDF