Bug #25374
closedRecursion error in typoscript when including typoscript files
100%
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)
Files
Updated by André Spindler over 13 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.
Updated by André Spindler over 13 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... ;-)
Updated by Tobias Liebig over 13 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?
Updated by Tobias Liebig over 13 years ago
we're going to "offer" this on the planned "bug-auction" tonight (t3board11). I'll take care of this issue.
Updated by Tobias Liebig over 13 years ago
- Subject changed from Recursion error in tseditor when including typoscript files to Recursion error in typoscript when including typoscript files
Updated by André Spindler over 13 years ago
Patch file for TYPO3 4.5.2 added.
Updated by Mr. Hudson over 13 years ago
Patch set 1 of change I3d8e267e129afd9c88160fed990710237438b48a has been pushed to the review server.
It is available at http://review.typo3.org/1360
Updated by Tobias Liebig over 13 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".
Updated by Mr. Hudson over 13 years ago
Patch set 1 of change I2b1363506e5b01a9fb8fa47b792d3351d302eaa9 has been pushed to the review server.
It is available at http://review.typo3.org/1362
Updated by Mr. Hudson over 13 years ago
Patch set 1 of change I220ee78da5875ff66753769f2e704a49539dff31 has been pushed to the review server.
It is available at http://review.typo3.org/1365
Updated by Mr. Hudson over 13 years ago
Patch set 2 of change I220ee78da5875ff66753769f2e704a49539dff31 has been pushed to the review server.
It is available at http://review.typo3.org/1365
Updated by Mr. Hudson over 13 years ago
Patch set 2 of change I2b1363506e5b01a9fb8fa47b792d3351d302eaa9 has been pushed to the review server.
It is available at http://review.typo3.org/1362
Updated by Mr. Hudson over 13 years ago
Patch set 3 of change I2b1363506e5b01a9fb8fa47b792d3351d302eaa9 has been pushed to the review server.
It is available at http://review.typo3.org/1362
Updated by Tobias Liebig over 13 years ago
- Status changed from Under Review to Resolved
Applied in changeset 33bec963fcdf76e3474277e95dc535176773be01.