Bug #104608
opentree variable doesn't exist in page tsconfig condition when deleting a page
0%
Description
I got the following condition in page tsconfig:
[44 in tree.rootLineIds || 55 in tree.rootLineIds || 91 in tree.rootLineIds || 144 in tree.rootLineIds || 148 in tree.rootLineIds] TCAdefaults { pages { no_index = 1 no_follow = 1 no_search = 1 } } [end]
Now when I delete a page in any page tree I get the following error logged:
Extension/Facility: TYPO3.CMS.Core.TypoScript.IncludeTree.Visitor.IncludeTreeConditionMatcherVisitor
Message: Expression could not be parsed.
Exception message of the Symfony\Component\ExpressionLanguage\SyntaxError: Variable "tree" is not valid at around position...
This error only occurs if the page tsconfig is added in the ext_localconf.php or ext_tables.php file of a extension via
ExtensionManagementUtility::addPageTSConfig(
'@import \'EXT:ext_key/Configuration/TsConfig/Page/All.tsconfig\''
);
If I add the tsconfig through a page record and it's TSconfig field everything is fine and no error occurs.
Is this a known limitation or a bug?
Updated by Hannes Bochmann 3 months ago
The correct message of the Symfony\Component\ExpressionLanguage\SyntaxError is: Variable "tree" is not valid around position
Updated by Garvin Hicking 3 months ago · Edited
- Category set to TypoScript
- Status changed from New to Needs Feedback
Have you tried using traverse() checks instead, those can catch undefined TypoScript variables without producing errors.
Updated by Hannes Bochmann 3 months ago
Yeah, I tried everything that came to my mind. Adding "tree && (44 in tree.rootLineIds)..." or "traverse(tree, 'rootLineIds') == 44" or "tree ?? '' && (44 in tree.rootLineIds)..." or "44 in tree?.rootLineIds" but nothing changed the error.
Updated by Andreas Pfeiffer 24 days ago
Hi, i have the same problem. But the context is different. I have written a module which has no page tree and all the time i use the data handler to store records i got the same error in log.
Well, as hannes wrote, i have not found a solution in the data handler but via typoscript you may work around the tree.
I have similar typoscript conditions [150 in tree.rootLineIds] - isn´t there a way to check in the condition if tree is empty? In my case rootLineIds is not sooo needy and i switched to conditions like [traverse(page, "uid") == 150]. May be not the best solution but for me it works and the log keeps clean.
Updated by S P 20 days ago · Edited
Can confirm. I have this [70 in tree.rootLineIds || 117 in tree.rootLineIds || 562 in tree.rootLineIds]
and this creates for currently-to-me-unknown reasons in currently-to-me-unknown situations (no time for in-depth analysis atm), sometimes the error:
Expression could not be parsed. - {"expression":"70 in tree.rootLineIds || 117 in tree.rootLineIds || 562 in tree.rootLineIds"}