Bug #25374

Recursion error in typoscript when including typoscript files

Added by André Spindler over 6 years ago. Updated over 6 years ago.

Status:
Resolved
Priority:
Must have
Assignee:
Category:
-
Target version:
-
Start date:
2011-03-22
Due date:
% Done:

100%

TYPO3 Version:
4.5
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I switched templating on one of my installations.
So now there are 9 setup files for the template paths. I include the all in only one template record on root-level of the page tree.
And all works fine.

But then I install an additional extension and also I create the next typoscript file and add the definitions for this extension.
When I now open the typoscript editor for the setup field and enable the include of the file contents, the content of the last/10th file is overwritten with "### ERROR: Recursion!".
So I only can include 9 typoscript files.
If you don't care about this, the content if the file is deleted an page rendering is broken.

But there is no recursion in the files at all!
I include them all in the template record, no file is included by another!
And if I remove a file in the middle, the last file is loaded correct.

Also the extension t3editor is NOT installed, I use the default editor in tstemplate_info.

(issue imported from #M18012)

recursion_error_in_typoscript.patch View (880 Bytes) André Spindler, 2011-03-31 14:31

Associated revisions

Revision 497aa836 (diff)
Added by Tobias Liebig over 6 years ago

[BUGFIX] Recursion error in typoscript when including typoscript files

In template module, when editing typoscript and using the "Include
TypoScript file content" option with more then 9 files, the 10th and
more files got screwed up.

Thanks to André Spindler for reporting and providing a patch.
Thanks to Kilian Hann (futureconnection AG Zürich) for sponsoring
100 beers during the bug auction.

Change-Id: I220ee78da5875ff66753769f2e704a49539dff31
Resolves: #25374
Reviewed-on: http://review.typo3.org/1365
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
Reviewed-by: Sebastian Fischer
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn

Revision 33bec963 (diff)
Added by Tobias Liebig over 6 years ago

[BUGFIX] Recursion error when including TypoScript files

When editing TypoScript in the template module and using the "Include
TypoScript file content" option with more than 9 files, then the 10th
and all later files gets screwed up.

Thanks to André Spindler for reporting and providing a patch.
Thanks to Kilian Hann (futureconnection AG Zürich) for sponsoring
100 beers during the bug auction.

Change-Id: I2b1363506e5b01a9fb8fa47b792d3351d302eaa9
Resolves: #25374
Reviewed-on: http://review.typo3.org/1362
Reviewed-by: Michael Stucki
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
Reviewed-by: Sebastian Fischer
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn

History

#1 Updated by André Spindler over 6 years ago

I now checked some code (class t3lib_tsparser):

When an opening include tag is foun in the typoscript code, the function "extractIncludes" is called its parameter "cycle_counter" is increased.
But it is not decreased then the correspondending end tag of the file include is found.
And this function stops working if the counter has reached a limit of 10.

The function "checkIncludeLines" is obviously used whewn rendering the page. This function also lacks the code to decrease the counter. But in this function the limit is set to 100.

#2 Updated by André Spindler over 6 years ago

Now I found the fix for this problem:

In "class.t3lib_tsparser.php" the line 729 (4.5.2) has to be modified:
Original:
$fileContentString = self::extractIncludes($fileContentString, ++$cycle_counter, $extractedFileNames);

Correct:
$fileContentString = self::extractIncludes($fileContentString, $cycle_counter + 1, $extractedFileNames);

So every time the function is called within the foreach loop all includes on the same level are called with the same recursion level. Without the patch this level is increased every time.

I told about the function "checkIncludeLines" before, which also uses this recursion, the line there looks like this:
$included_text = self::checkIncludeLines(t3lib_div::getUrl($filename), $cycle_counter + 1, $returnFiles);
You can see, there is no such problem... ;-)

#3 Updated by Tobias Liebig over 6 years ago

  • Assignee set to Tobias Liebig
  • Target version deleted (0)

Hej André,

thanks for digging into the issue.
Can you make a patch and push it to gerrit or send it to me?

#4 Updated by Tobias Liebig over 6 years ago

we're going to "offer" this on the planned "bug-auction" tonight (t3board11). I'll take care of this issue.

#5 Updated by Tobias Liebig over 6 years ago

  • Subject changed from Recursion error in tseditor when including typoscript files to Recursion error in typoscript when including typoscript files

#6 Updated by André Spindler over 6 years ago

Patch file for TYPO3 4.5.2 added.

#7 Updated by Mr. Hudson over 6 years ago

Patch set 1 of change I3d8e267e129afd9c88160fed990710237438b48a has been pushed to the review server.
It is available at http://review.typo3.org/1360

#8 Updated by Tobias Liebig over 6 years ago

  • Status changed from New to Under Review
  • Priority changed from Should have to Must have
  • % Done changed from 0 to 100

Kilian Hann (futureconnection AG Zürich) wins the bug auction for this bug by biting 100 "beers".

#9 Updated by Mr. Hudson over 6 years ago

Patch set 1 of change I2b1363506e5b01a9fb8fa47b792d3351d302eaa9 has been pushed to the review server.
It is available at http://review.typo3.org/1362

#10 Updated by Mr. Hudson over 6 years ago

Patch set 1 of change I220ee78da5875ff66753769f2e704a49539dff31 has been pushed to the review server.
It is available at http://review.typo3.org/1365

#11 Updated by Mr. Hudson over 6 years ago

Patch set 2 of change I220ee78da5875ff66753769f2e704a49539dff31 has been pushed to the review server.
It is available at http://review.typo3.org/1365

#12 Updated by Mr. Hudson over 6 years ago

Patch set 2 of change I2b1363506e5b01a9fb8fa47b792d3351d302eaa9 has been pushed to the review server.
It is available at http://review.typo3.org/1362

#13 Updated by Mr. Hudson over 6 years ago

Patch set 3 of change I2b1363506e5b01a9fb8fa47b792d3351d302eaa9 has been pushed to the review server.
It is available at http://review.typo3.org/1362

#14 Updated by Tobias Liebig over 6 years ago

  • Status changed from Under Review to Resolved

Also available in: Atom PDF