Project

General

Profile

Actions

Bug #87386

closed

Correct ExpressionLanguage based TypoScript condition throws deprecation in TYPO3 backend

Added by Josef Glatz about 5 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
TypoScript
Target version:
-
Start date:
2019-01-10
Due date:
% Done:

0%

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

Description

Problem/Description

The following TypoScript condition doesn't throw a deprecation in the frontend (and works like it should work):

[{$thm.debug} == 1 && getTSFE().beUserLogin === 1 || applicationContext matches "/^Development/"]

Problem

On (every) request in the TYPO3 backend (like the TYPO3 About module) a deprecation message is generated:

It seems like if an extension does load TypoScript in the backend context (in this example it's https://github.com/lochmueller/autoloader/, https://github.com/lochmueller/faq/), the getTSFE().beUserLogin ExpressionLanguage object doesn't exists.

Thu, 10 Jan 2019 08:00:42 +0100 [ERROR] request="6acca7bf023af" component="TYPO3.CMS.Frontend.Configuration.TypoScript.ConditionMatching.ConditionMatcher": Unable to get a property on a non-object. - {"expression":"1 == 1 && getTSFE().beUserLogin === 1 || applicationContext matches \"\/^Development\/\"","exception":"RuntimeException: Unable to get a property on a non-object. in \/app\/vendor\/symfony\/expression-language\/Node\/GetAttrNode.php:73\nStack trace:\n#0 \/app\/vendor\/symfony\/expression-language\/Node\/BinaryNode.php(90): Symfony\\Component\\ExpressionLanguage\\Node\\GetAttrNode->evaluate(Array, Array)\n#1 \/app\/vendor\/symfony\/expression-language\/Node\/BinaryNode.php(109): Symfony\\Component\\ExpressionLanguage\\Node\\BinaryNode->evaluate(Array, Array)\n#2 \/app\/vendor\/symfony\/expression-language\/Node\/BinaryNode.php(90): Symfony\\Component\\ExpressionLanguage\\Node\\BinaryNode->evaluate(Array, Array)\n#3 \/app\/vendor\/symfony\/expression-language\/ExpressionLanguage.php(67): Symfony\\Component\\ExpressionLanguage\\Node\\BinaryNode->evaluate(Array, Array)\n#4 \/app\/web\/typo3\/sysext\/core\/Classes\/ExpressionLanguage\/Resolver.php(77): Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage->evaluate('1 == 1 && getTS...', Array)\n#5 \/app\/web\/typo3\/sysext\/core\/Classes\/Configuration\/TypoScript\/ConditionMatching\/AbstractConditionMatcher.php(266): TYPO3\\CMS\\Core\\ExpressionLanguage\\Resolver->evaluate('1 == 1 && getTS...')\n#6 \/app\/web\/typo3\/sysext\/core\/Classes\/Configuration\/TypoScript\/ConditionMatching\/AbstractConditionMatcher.php(241): TYPO3\\CMS\\Core\\Configuration\\TypoScript\\ConditionMatching\\AbstractConditionMatcher->evaluateExpression('1 == 1 && getTS...')\n#7 \/app\/web\/typo3\/sysext\/core\/Classes\/TypoScript\/Parser\/TypoScriptParser.php(296): TYPO3\\CMS\\Core\\Configuration\\TypoScript\\ConditionMatching\\AbstractConditionMatcher->match('[1 == 1 && getT...')\n#8 \/app\/web\/typo3\/sysext\/core\/Classes\/TypoScript\/TemplateService.php(1220): TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser->parse('\\n[GLOBAL]\\n\\n[GLO...', Object(TYPO3\\CMS\\Frontend\\Configuration\\TypoScript\\ConditionMatching\\ConditionMatcher))\n#9 \/app\/web\/typo3\/sysext\/extbase\/Classes\/Configuration\/BackendConfigurationManager.php(73): TYPO3\\CMS\\Core\\TypoScript\\TemplateService->generateConfig()\n#10 \/app\/web\/typo3\/sysext\/extbase\/Classes\/Configuration\/AbstractConfigurationManager.php(215): TYPO3\\CMS\\Extbase\\Configuration\\BackendConfigurationManager->getTypoScriptSetup()\n#11 \/app\/web\/typo3\/sysext\/extbase\/Classes\/Configuration\/AbstractConfigurationManager.php(151): TYPO3\\CMS\\Extbase\\Configuration\\AbstractConfigurationManager->getExtbaseConfiguration()\n#12 \/app\/web\/typo3\/sysext\/extbase\/Classes\/Configuration\/ConfigurationManager.php(127): TYPO3\\CMS\\Extbase\\Configuration\\AbstractConfigurationManager->getConfiguration('faq', NULL)\n#13 \/app\/web\/typo3\/sysext\/extbase\/Classes\/Utility\/LocalizationUtility.php(233): TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager->getConfiguration('Framework', 'faq')\n#14 \/app\/web\/typo3\/sysext\/extbase\/Classes\/Utility\/LocalizationUtility.php(165): TYPO3\\CMS\\Extbase\\Utility\\LocalizationUtility::loadTypoScriptLabels('faq', 'EXT:faq\/Resourc...')\n#15 \/app\/web\/typo3\/sysext\/extbase\/Classes\/Utility\/LocalizationUtility.php(96): TYPO3\\CMS\\Extbase\\Utility\\LocalizationUtility::initializeLocalization('EXT:faq\/Resourc...', 'default', Array, 'faq')\n#16 \/app\/web\/typo3conf\/ext\/autoloader\/Classes\/Localization\/LanguageHandler.php(44): TYPO3\\CMS\\Extbase\\Utility\\LocalizationUtility::translate('tx_faq_domain_m...', 'faq', NULL)\n#17 \/app\/web\/typo3conf\/ext\/autoloader\/Classes\/Hooks\/Localization.php(38): HDNET\\Autoloader\\Localization\\LanguageHandler->handle('tx_faq_domain_m...', 'faq', 'title', NULL, NULL)\n#18 \/app\/web\/typo3conf\/ext\/autoloader\/Classes\/Utility\/TranslateUtility.php(48): HDNET\\Autoloader\\Hooks\\Localization->assureLabel('tx_faq_domain_m...', 'faq', 'title', NULL, 'tx_faq_domain_m...')\n#19 \/app\/web\/typo3conf\/ext\/autoloader\/Classes\/Service\/SmartObjectInformationService.php(82): HDNET\\Autoloader\\Utility\\TranslateUtility::assureLabel('tx_faq_domain_m...', 'faq', 'title', NULL, 'tx_faq_domain_m...')\n#20 \/app\/web\/typo3conf\/ext\/autoloader\/Classes\/Service\/SmartObjectInformationService.php(123): HDNET\\Autoloader\\Service\\SmartObjectInformationService->getCustomModelFieldTca('HDNET\\\\Faq\\\\Domai...', Array)\n#21 \/app\/web\/typo3conf\/ext\/autoloader\/Classes\/Utility\/ModelUtility.php(103): HDNET\\Autoloader\\Service\\SmartObjectInformationService->getTcaInformation('HDNET\\\\Faq\\\\Domai...')\n#22 \/app\/web\/typo3conf\/ext\/faq\/Configuration\/TCA\/tx_faq_domain_model_question.php(6): HDNET\\Autoloader\\Utility\\ModelUtility::getTcaInformation('HDNET\\\\Faq\\\\Domai...')\n#23 \/app\/web\/typo3\/sysext\/core\/Classes\/Utility\/ExtensionManagementUtility.php(1684): require('\/app\/web\/typo3c...')\n#24 \/app\/web\/typo3\/sysext\/core\/Classes\/Utility\/ExtensionManagementUtility.php(1654): TYPO3\\CMS\\Core\\Utility\\ExtensionManagementUtility::buildBaseTcaFromSingleFiles()\n#25 \/app\/web\/typo3\/sysext\/core\/Classes\/Core\/Bootstrap.php(834): TYPO3\\CMS\\Core\\Utility\\ExtensionManagementUtility::loadBaseTca(true, Object(TYPO3\\CMS\\Core\\Cache\\Frontend\\PhpFrontend))\n#26 \/app\/web\/typo3\/sysext\/core\/Classes\/Core\/Bootstrap.php(141): TYPO3\\CMS\\Core\\Core\\Bootstrap::loadBaseTca(true, Object(TYPO3\\CMS\\Core\\Cache\\Frontend\\PhpFrontend))\n#27 \/app\/web\/typo3\/index.php(24): TYPO3\\CMS\\Core\\Core\\Bootstrap::init(Object(Composer\\Autoload\\ClassLoader))\n#28 \/app\/web\/typo3\/index.php(25): {closure}()\n#29 {main}"}
*

ToDo(s)

  • Is it necessary, to add a check in the "ExpressionLanguage part" of TYPO3? Other ExpressionLanguage function could be affected as well - Unfortunately I am not deep inside that part of TYPO3.
  • Are there any other areas in the backend (e.g. a custom backend module) where the problem might arise?

At time of writing / last editing this issue:
- affected TYPO3 version: 9.5 and dev-master (10)


Related issues 1 (0 open1 closed)

Is duplicate of TYPO3 Core - Bug #87021: Using "getTSFE().beUserLogin == 1" as expression in an TypoScript condition leads to an error in the Symfony Expression LanguageClosed2018-11-28

Actions
Actions #1

Updated by Josef Glatz about 5 years ago

  • Priority changed from Should have to Must have
Actions #2

Updated by Markus Bischof over 4 years ago

+1

Actions #3

Updated by Frank Nägler over 4 years ago

  • Status changed from New to Needs Feedback

If you write the condition "correct" it will work also in the backend, means use something like this:

[{$thm.debug} == 1 && getTSFE() && getTSFE().beUserLogin === 1 || applicationContext matches "/^Development/"]

I guess this should solve your issue. right?

Actions #4

Updated by Markus Klein about 4 years ago

  • Is duplicate of Bug #87021: Using "getTSFE().beUserLogin == 1" as expression in an TypoScript condition leads to an error in the Symfony Expression Language added
Actions #5

Updated by Markus Klein about 4 years ago

  • Status changed from Needs Feedback to Closed
Actions

Also available in: Atom PDF