From 40115724193d1205d1a4aea54251de859d1e4351 Mon Sep 17 00:00:00 2001
From: Andreas Allacher <andreas.allacher@gmx.at>
Date: Fri, 20 Feb 2015 10:23:40 +0100
Subject: [PATCH] [BUGFIX] Prevent deletion of closing bracket via
 INCLUDE_TYPOSCRIPT

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
Reviewed-on: http://review.typo3.org/37038
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Benjamin Mack <benni@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 .../core/Classes/TypoScript/Parser/TypoScriptParser.php       | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php b/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php
index 44c63c966689..3668a1c85239 100644
--- a/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php
+++ b/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php
@@ -860,8 +860,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
-- 
GitLab