Bug #84534

Dots in TypoScript keys break autocomplete

Added by Henning no-lastname-given over 1 year ago. Updated 6 months ago.

Status:
Accepted
Priority:
Should have
Assignee:
-
Category:
t3editor
Target version:
-
Start date:
2018-03-26
Due date:
% Done:

0%

TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

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

History

#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

Thanks, Guido

#2 Updated by Henning no-lastname-given over 1 year ago

Hi Guido,

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.

#3 Updated by Gerrit Code Review over 1 year ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56784

#4 Updated by Guido Schmechel over 1 year ago

Hi Henning,

thanks yor your explanation. I could reproduce this issue in version 8 and 9. Maybe my patchset is too simple, but let's wait for the reviews :-)

Best, Guido

#5 Updated by F Altrock 9 months ago

I have this issue because of ElasticSearch filter names for nested document properties, which also contain a period.
It's clogging up the logs...

So 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. (convertTypoScriptArrayToPlainArray
uses _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
suggestions. (?)
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
to handle keys with dots in them. But the JavaScript part needs to be patched too to recognize TypoScript keys
with escaped dots as one key ... the JavaScript in https://github.com/TYPO3-CMS/t3editor/tree/v9.5.1/Resources/Public/JavaScript/Addon/Hint
has plenty of foo.split('.') and bar.join('.') code.

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

Edit:
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

#7 Updated by Susanne Moog 6 months ago

  • Status changed from Under Review to Accepted

Patch has been abandoned.

Also available in: Atom PDF