Bug #105864
openSite settings configuration is not working in TSconfig condition
0%
Description
In TYPO3 12 & 13 this condition is not working in TSconfig and throws a log error.
[traverse(page, "uid") == {$myextension.news.startingPoint}]
Expression could not be parsed. - {"expression":"traverse(page, \"uid\") == {$myextension.news.startingPoint}"}
This is also not working but doesn't throw a log error:
[traverse(page, "uid") == "{$myextension.news.startingPoint}"]
For reference, in TYPO3 11 this worked:
[page["uid"] == {$myextension.news.startingPoint}]
Maybe this could also be related to: https://forge.typo3.org/issues/100810
Files
Updated by Garvin Hicking 18 days ago
- Status changed from New to Needs Feedback
Where and how exactly do you set $myextension.news.startingPoint ?
Updated by Raphael Zschorsch 18 days ago · Edited
I set it like this in the site configuration settings.yaml file:
myextension:
news:
startingPoint: 14
categoryUid: 2
If I leave out the condition part, this works btw:
TCAdefaults { tx_news_domain_model_news { categories = {$myextension.news.categoryUid} } }
Updated by Garvin Hicking 18 days ago
Not exactly my area but have you checked https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/SiteHandling/UseSiteInConditions.html#typoscript-examples and tried something like:
[traverse(page, "uid") == site("configuration")["myextension.news.startingPoint"]]
Could also be
[traverse(page, "uid") == site("configuration")["myextension"]["news"][startingPoint"]]
I believe expressions are diffferently evaluated and maybe before other constants are resolved like for content assignment in "pure" typoscript.
(Can't check the code right now as I'm only on mobile but maybe this helps)
Updated by Raphael Zschorsch 18 days ago
Unfortunately this doesn't work. :(
I should also mention, that in the "Page TSconfig" backend module, the values are correctly substituted, so my guess is, that there is a bug in the condition evaluation.
Updated by Garvin Hicking 8 days ago
I now finally tried this with v14 main and v13.
I used the dummy installation here: https://github.com/TYPO3-Documentation/site-introduction.git
- git clone
- ddev start
- make install
- enter password
- ddev launch typo3
- login to backend
- Create file config/sites/main/settings.yaml
- Insert simple content somePageUid: 7
- Edit page properties of page UID 7 and set TSconfig to:
[traverse(page, "uid") == {$somePageUid}] TCEFORM.tt_content.header_layout { removeItems := addToList(100) } [global] TCEFORM.tt_content.header_layout { removeItems := addToList(4,5) }
- Edit a content elemennt on page uid 8 and see "header_layout" can be set to the values "0,2,3,4,5,100"
- Edit a content elemennt on page uid 7 and see "header_layout" can only be set to the values "0,2,3"
Could you please describe where I diverge from the setup that creates the issues for you? Do you maybe have an extension at work that operates on the symfony expressions and manipulate it?
Updated by Raphael Zschorsch 7 days ago
I can't seem to get it to work. Even without the variable, a simple:
[traverse(page, "uid") == 1]
only works sometimes in Page TSconfig, i.e.:
[traverse(page, "uid") == 14] TCAdefaults { tx_news_domain_model_news { categories = 2 } } [END]
I can't really figure out why it works sometimes or why it fails when I reload all caches of replace 14 with a variable from the site configuration settings.
Can you please check if the above code is working for you? I don't get any errors in the TYPO3 log file, even with my custom conditions. I also deactivated my custom conditions but still, this is almost only working once and only on page ID 1. Page ID 14 i.e. is not working every time. This is just for TSconfig, in TypoScript the same condition works every time, i.e.
[traverse(page, "uid") == 4] page > [END]
Can you also please check a variable like this extension.xyz.somePageUid instead of only somePageUid?
I set the page TSconfig in the file Configuration/page.tsconfig and not in the page properties. But even in the page properties the condition won't work.
Updated by Garvin Hicking 7 days ago
Yes, I also verified this works with a extensions.xxx.yyy subarray.
It would be helpful if you can get the site-introduction repository to work for us to align our tests?
Your problem could stem from several issues (sitepackages, third party extensions, pagetree TS) and we need to find the minimal setup to trigger your problem. If you can see it working with the site-introduction, then you could try to step-by-step add other parts into it, and see where the problem may be caused.
Updated by Raphael Zschorsch 3 days ago · Edited
Again, I'm really quite puzzled.
/typo3temp/var/log logfile says this:
Sat, 11 Jan 2025 17:48:00 +0100 [ERROR] request="58d8e84cf1bf9" component="TYPO3.CMS.Core.TypoScript.IncludeTree.Visitor.IncludeTreeConditionMatcherVisitor": Expression could not be parsed. - {"expression":"traverse(page, \"uid\") == {$somePageUid}"}
And I again want to point out, that the expression is correctly displayed in the backend TSConfig module (see attached screenshot).
What does your logfile say?
Maybe this could also be related?
Updated by Garvin Hicking 3 days ago
We can only progress here if you could please do what I asked with the site-introduction package and exact steps to reproduce. Thank you!
Updated by Raphael Zschorsch 1 day ago
I finally figured out what the problem was and this was on my side as I loaded the whole TSconfig for a check in a custom function (BackendUtility::getPagesTSconfig). I fixed this and not the conditions are working, although an error is still thrown in the log file as I mentioned before:
Sat, 11 Jan 2025 17:48:00 +0100 [ERROR] request="58d8e84cf1bf9" component="TYPO3.CMS.Core.TypoScript.IncludeTree.Visitor.IncludeTreeConditionMatcherVisitor": Expression could not be parsed. - {"expression":"traverse(page, \"uid\") == {$somePageUid}"}
This is also the case in my test environment with the introduction package as you suggested. Can you confirm this?
Updated by Garvin Hicking about 12 hours ago
- Status changed from Needs Feedback to Accepted
Actually I had logging disabled and only checked whether it worked or not. Thanks for insisting to check this!
Indeed I can see the error messages in my log now too. My guess is that the TypoScript parser makes more than one round-trip to parse the TSconfig, once without the site settings applied, and once with.
That requires some more inspection/debugging/tracing.