[BUGFIX] Prevent deletion of closing bracket via INCLUDE_TYPOSCRIPT 24/44724/2
authorAndreas Allacher <andreas.allacher@gmx.at>
Sun, 15 Nov 2015 11:45:53 +0000 (12:45 +0100)
committerMarkus Klein <markus.klein@typo3.org>
Sat, 21 Nov 2015 14:54:14 +0000 (15:54 +0100)
Due to missing check of the last char being a new line, it is
possible that a closing bracket character is removed by
using INCLUDE_TYPOSCRIPT.
This leads to broken typoscript.
By introducing the missing check this kind of error is prevented.

Change-Id: I92ef213d31c4d62ba797e2741d5a0beaa042c6b3
Resolves: #62280
Releases: master, 6.2
Reviewed-on: https://review.typo3.org/44724
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Andreas Allacher <andreas.allacher@gmx.at>
Reviewed-by: Martin Kutschker <martin.kutschker@ymail.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php

index 10f757a..dcdbfcf 100644 (file)
@@ -837,8 +837,8 @@ class TypoScriptParser {
                                }
 
                        }
-                       // Not the first/last linebreak char.
-                       $string = substr($newString, 1, -1);
+                       // Add a line break before and after the included code in order to make sure that the parser always has a LF.
+                       $string = LF . trim($newString) . LF;
                }
                // When all included files should get returned, simply return an compound array containing
                // the TypoScript with all "includes" processed and the files which got included