Project

General

Profile

Actions

Bug #104608

open

tree variable doesn't exist in page tsconfig condition when deleting a page

Added by Hannes Bochmann 3 months ago. Updated 20 days ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
TypoScript
Target version:
-
Start date:
2024-08-13
Due date:
% Done:

0%

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

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?

Actions #1

Updated by Hannes Bochmann 3 months ago

The correct message of the Symfony\Component\ExpressionLanguage\SyntaxError is: Variable "tree" is not valid around position

Actions #2

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.

Actions #3

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.

Actions #4

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.

Actions #5

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"}

Actions

Also available in: Atom PDF