Dots in TypoScript keys break autocomplete
There are <meta> properties that have dots in them like
<meta name="geo.region" content="DE-RP">
The corresponding TypoScript would look like:
page.meta.geo\.region = DE-RP
This causes the following error:
Argument 1 passed to TYPO3\CMS\T3editor\CodeCompletion::treeWalkCleanup() must be of the type array, string given, called in /var/www/app/vendor/typo3/cms/typo3/sysext/t3editor/Classes/CodeCompletion.php on line 134
#1 Updated by Guido Schmechel over 1 year ago
Hi Henning, can you please recheck this issue? I can't produce this issue on 8.7.13 and current master. Maybe you can describe your case?
- Open the page template via "TEMPLATE"
- Set the values in the "Setup" area
- Wrote every letter and the popup from PAGE and META appears
#2 Updated by Henning no-lastname-given over 1 year ago
sorry. Steps to reproduce:
Setup, that breaks:
page.meta.foo\.bar = baz
1. Add TypoScript progragramatically from PHP either via TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup or ::addStaticFile + include in backend
2. Open the Template module and chose a template that is affected by the included TS
3. Open the Setup in t3editor (this should already execute an XHR request that causes the error)
4. Type something that should bring up the autocomplete wizard or force via Ctrl + Space
The XHR-request in the background will fail with the stated error.
I have this issue because of ElasticSearch filter names for nested document properties, which also contain a period.
It's clogging up the logs...
treeWalkCleanup does basically the same as
convertTypoScriptArrayToPlainArray, that is to say:
fix the keys in a TypoScript array so that a node in the tree can have a value and child nodes at the same time.
Here we generate
v-keys for values in the node and
c-keys for sub-branches. (
_typoScriptNodeValue for the values at the nodes, at the same level as the tree children.)
This is necessary because the result is serialized as JSON and used in the CodeMirror completion handler¸
and I guess the person that coded that piece of functionality did not want to have the dots in the completion
I personally have no problem at all if the T3Editor gives me names with a dot at the end as a completion, because
really, most of the time I need the dot anyway...
With this patch: https://gist.github.com/faltrock-abone/c4974a29b411d2402e2f286c3d0f5052 I fixed the backend part
has plenty of
This does not seem easy to fix.
#6 Updated by Bastian Stargazer 6 months ago
I could reproduce this issue in version 8 and 9. Maybe my patchset is too simple, but let's wait for the reviews :-)
Any news or updates on this? I'm using metatags with a dot in them as well (escaped the with a backslash like meta.geo\.position), and each click to edit the root-template throws the exception, that becomes a log flood after a while...
Working on TYPO3 9.5.4
In TYPO3 9.5.4 the error message looks slightly different from posted by thread opener, but I guess its the same issue:
Core: Exception handler (WEB): Uncaught TYPO3 Exception: Argument 1 passed to TYPO3\CMS\T3editor\Controller\CodeCompletionController::treeWalkCleanup() must be of the type array, string given, called in [...]/libraries/typo3_src-9.5.4/typo3/sysext/t3editor/Classes/Controller/CodeCompletionController.php on line 103 | TypeError thrown in file [...]/libraries/typo3_src-9.5.4/typo3/sysext/t3editor/Classes/Controller/CodeCompletionController.php in line 85. Requested URL: https://www.mysite.com/typo3/index.php?route=%%2Fajax%%2Ft3editor%%2Fcodecompletion%%2Fload-templates&token=--AnonymizedToken--&pageId=1