Issue Bug Closed

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

Hannes Bochmann 08/13/24, 07:49 updated 10/24/26, 07:17

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?

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 11

  1. Hannes Bochmann commented <span data-processor="relativetime" data-value="2024-08-13T07:51:16+00:00" > 08/13/24, 07:51 </span>

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

  2. Garvin Hicking commented and changed category status New Needs Feedback <span data-processor="relativetime" data-value="2024-08-13T09:22:49+00:00" > 08/13/24, 09:22 </span>

    Have you tried using traverse() checks instead, those can catch undefined TypoScript variables without producing errors.

  3. Hannes Bochmann commented <span data-processor="relativetime" data-value="2024-08-13T09:30:04+00:00" > 08/13/24, 09:30 </span>

    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.

  4. Andreas Pfeiffer commented <span data-processor="relativetime" data-value="2024-10-07T20:21:45+00:00" > 10/07/24, 20:21 </span>

    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.

  5. S P commented <span data-processor="relativetime" data-value="2024-10-11T07:31:13+00:00" > 10/11/24, 07:31 </span>

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

  6. Stefan Terborg commented <span data-processor="relativetime" data-value="2025-04-16T05:49:09+00:00" > 04/16/25, 05:49 </span>

    I had the same errors in other context and found them caused by a solr bug: https://github.com/TYPO3-Solr/ext-solr/issues/4340

  7. Hannes Bochmann commented <span data-processor="relativetime" data-value="2025-04-22T08:00:06+00:00" > 04/22/25, 08:00 </span>

    I have no EXT:solr installed. So this should not be connected to this issue.

  8. Benni Mack commented and changed status Needs Feedback Closed <span data-processor="relativetime" data-value="2026-10-24T07:17:02+00:00" > 10/24/26, 07:17 </span>

    This is fixed with #109683

    The root cause (tree not being defined when no rootline is available) has been fixed in #109683 for v14.3 and main — tree is now always available and such conditions evaluate to false instead of logging a SyntaxError. Closing as duplicate. There is no backport to 13.4/12.4; the patch can be applied via composer patches if needed.