[BUGFIX] TS copy operator handles existing reference
This implements a rather unexpected detail when combining reference "=<" and copy "<" operator from old TypoScript parser. Copy operator: lib.source1 = TEXT lib.source1.value = source1Value lib.source2.otherValue = source2OtherValue tt_content.target < lib.source1 tt_content.target < lib.source2 Result: tt_content.target = TEXT tt_content.target.otherValue = source2OtherValue The tt_content.target existing value from lib.source1 is kept, but children are reset - lib.source1.value is not within tt_content.target anymore. Now reference first, then copy: lib.source1 = TEXT lib.source1.value = source1Value lib.source2.otherValue = source2OtherValue tt_content.target =< lib.source1 tt_content.target < lib.source2 Old parser after resolving reference in FE: tt_content.target = TEXT tt_content.target.value = source1Value tt_content.target.otherValue = source2OtherValue New parser after resolving reference in FE: tt_content.target = TEXT tt_content.target.otherValue = source2OtherValue The old parser keeps existing references when the copy operator does not reset the value to something else. The patch adapts the new parser to behave identical and refactors the AST copy method to better documented, more easy and eventually also quicker code. Resolves: #100115 Releases: main, 12.4 Change-Id: Ia03cefd6e550833bdc9120a179881d04bf70d117 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80509 Reviewed-by:Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
core-ci <typo3@b13.com> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch>
Showing
- typo3/sysext/core/Classes/TypoScript/AST/AbstractAstBuilder.php 56 additions, 38 deletions...sysext/core/Classes/TypoScript/AST/AbstractAstBuilder.php
- typo3/sysext/core/Classes/TypoScript/AST/AstBuilder.php 1 addition, 1 deletiontypo3/sysext/core/Classes/TypoScript/AST/AstBuilder.php
- typo3/sysext/core/Classes/TypoScript/AST/CommentAwareAstBuilder.php 1 addition, 1 deletion...xt/core/Classes/TypoScript/AST/CommentAwareAstBuilder.php
- typo3/sysext/core/Tests/Unit/TypoScript/AST/AstBuilderInterfaceTest.php 90 additions, 0 deletions...ore/Tests/Unit/TypoScript/AST/AstBuilderInterfaceTest.php
Please register or sign in to comment