Project

General

Profile

Actions

Bug #100205

closed

@import lost the flexibility from Symfony Finder

Added by Benjamin Serfhos over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
TypoScript
Target version:
Start date:
2023-03-17
Due date:
% Done:

100%

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

Description

https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/Configuration/TypoScriptSyntax/Syntax/Includes.html#typoscript-syntax-includes

The documentation mentioned `Internals: Under the hood, Symfony Finder is use to find the file and provides the "globbing" feature (* syntax).`

This implementation is lost since the deprecation of TyposcriptParser (https://review.typo3.org/c/Packages/TYPO3.CMS/+/76565). It simply uses the scandir() function in vendor/typo3/cms-core/Classes/TypoScript/IncludeTree/TreeFromLineStreamBuilder.php

My usecase was to dynamically include setup/constants for scoped extenion overrides;

In my constants.typoscript i have this;

@import 'EXT:my_package/Configuration/TypoScript/Extensions/*/constants.typoscript'

And my setup.typoscript i use a similar:

@import 'EXT:my_package/Configuration/TypoScript/Extensions/*/setup.typoscript'

This functionality is not working anymore in the new TreeFromLineStreamBuilder. As the Symfony Finder package is still widely used, I would suggest to keep using this package too.


Files

Scenario3.zip (1.72 KB) Scenario3.zip Scenario for testing Benjamin Serfhos, 2023-03-17 15:52
100205.patch (3.11 KB) 100205.patch Possible solution for using Symfony Finder Benjamin Serfhos, 2023-03-17 15:58

Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Feature #97816: New TypoScript parserClosed2022-06-27

Actions
Related to TYPO3 Core - Feature #90146: TypoScript includes and imports are a real performance bottleneck and should be cached (in a prod environment)Closed2020-01-18

Actions
Related to TYPO3 Core - Feature #82812: Introduce new @import syntax for TS includesClosedBenni Mack2017-10-19

Actions
Actions #2

Updated by Benjamin Serfhos over 1 year ago

See attached patch for using Symfony Finder; this resulted into errors for others, but as far i can see the result was still as expected.

Actions #3

Updated by Michael Voehringer over 1 year ago

If also have the problem, that imports with wildcard characters did not work in TYPO3 12.2

Example:

@import "EXT:theme_site/Configuration/TypoScript/Library/*.setup.typoscript"

Actions #4

Updated by Andreas Kienast over 1 year ago

IIRC, Symfony Finder was sacrificed due to performance reasons. Perhaps @Christian Kuhn can elaborate here.

Actions #5

Updated by Thomas Off over 1 year ago

With TYPO3 12.3 the wildcard import still, does not work.

If performance is a thing, that's a reasonable argument, but then the docs should reflect the change and the risks/issues that come with the change.

Actions #6

Updated by Michael Voehringer over 1 year ago

After playing around with TYPO3 12.3 it looks like this imports does not work any more:

@import "EXT:theme_site/Configuration/TypoScript/Library/*.setup.typoscript" 

But this kind of import works for me:

@import "EXT:theme_site/Configuration/TypoScript/Library/*.typoscript" 

@Christian Kuhn was that a design decision or is that a bug?

Actions #7

Updated by Christian Kuhn over 1 year ago

Actions #8

Updated by Christian Kuhn over 1 year ago

  • Related to Feature #90146: TypoScript includes and imports are a real performance bottleneck and should be cached (in a prod environment) added
Actions #9

Updated by Christian Kuhn over 1 year ago

  • Related to Feature #82812: Introduce new @import syntax for TS includes added
Actions #10

Updated by Christian Kuhn over 1 year ago

Wildcards in directories are not supported, this is considered invalid:

@import 'EXT:my_package/Configuration/TypoScript/Extensions/*/constants.typoscript'

A single wildcard for filenames is supported, this will be fixed:

@import "EXT:theme_site/Configuration/TypoScript/Library/*.setup.typoscript" 

I'll push a patch to fix the *.something.typoscript scenario, and will adapt the ReST file at https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/12.0/Breaking-97816-TypoScriptSyntaxChanges.html to clarify @import restrictions.

Actions #11

Updated by Gerrit Code Review over 1 year ago

  • Status changed from New to Under Review

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

Actions #12

Updated by Gerrit Code Review over 1 year ago

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78331

Actions #13

Updated by Gerrit Code Review over 1 year ago

Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78331

Actions #14

Updated by Gerrit Code Review over 1 year ago

Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78331

Actions #15

Updated by Christian Kuhn over 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #16

Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF