[BUGFIX] Configuration Tool creates invalid extTables.php file
[Packages/TYPO3.CMS.git] / typo3 / sysext / lowlevel / config / index.php
index c7383b8..f71ad62 100755 (executable)
@@ -285,7 +285,8 @@ class SC_mod_tools_config_index {
                                }
 
                                        // insert line in extTables.php
-                               $extTables = '<?php' . preg_replace('/<\?php|\?>/is', '', $extTables) . $changedLine . LF . '?>';
+                               $extTables = preg_replace('/<\?php|\?>/is', '', $extTables);
+                               $extTables = '<?php' . (empty($extTables) ? LF : '') . $extTables . $changedLine . LF . '?>';
                                $success = t3lib_div::writeFile(PATH_typo3conf . TYPO3_extTableDef_script, $extTables);
                                if ($success) {
                                                // show flash message