From e2cd28e149bc3efe288dc73bc9a6f5e1771ccca2 Mon Sep 17 00:00:00 2001
From: Markus Hoelzle <typo3@markus-hoelzle.de>
Date: Sat, 9 Sep 2017 23:02:14 +0200
Subject: [PATCH] [!!!][TASK] Remove old typoscript constants editor defaults
 option
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Remove support for the special constant comment
`###MOD_TS:EDITABLE_CONSTANTS###`. This constant was used to show
all constants before this comment as default constants in constants
editor and is dropped as ancient and widely unknown and rarely used
feature.

Releases: master
Resolves: #82425
Change-Id: I5345871818e1d627cacb8be6db2ab8629770237e
Reviewed-on: https://review.typo3.org/54086
Reviewed-by: Joerg Kummer <typo3@enobe.de>
Tested-by: Joerg Kummer <typo3@enobe.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Markus Hölzle <typo3@markus-hoelzle.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
---
 .../TypoScript/ExtendedTemplateService.php    | 19 +----------
 ...tsEditorOptionMOD_TSEDITABLE_CONSTANTS.rst | 32 +++++++++++++++++++
 .../Php/PropertyPublicMatcher.php             |  5 +++
 ...ConstantEditorModuleFunctionController.php |  2 +-
 4 files changed, 39 insertions(+), 19 deletions(-)
 create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Breaking-82425-RemoveOldTyposcriptConstantsEditorOptionMOD_TSEDITABLE_CONSTANTS.rst

diff --git a/typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php b/typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php
index ee920bf95716..5ea0f7072bcf 100644
--- a/typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php
+++ b/typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php
@@ -33,14 +33,6 @@ use TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatch
  */
 class ExtendedTemplateService extends TemplateService
 {
-    /**
-     * This string is used to indicate the point in a template from where the editable constants are listed.
-     * Any vars before this point (if it exists though) is regarded as default values.
-     *
-     * @var string
-     */
-    public $edit_divider = '###MOD_TS:EDITABLE_CONSTANTS###';
-
     /**
      * Disabled in backend context
      *
@@ -320,7 +312,7 @@ class ExtendedTemplateService extends TemplateService
 
     /**
      * Parse constants with respect to the constant-editor in this module.
-     * In particular comments in the code are registered and the edit_divider is taken into account.
+     * In particular comments in the code are registered.
      *
      * @return array
      */
@@ -343,11 +335,6 @@ class ExtendedTemplateService extends TemplateService
         foreach ($this->constants as $str) {
             $c++;
             if ($c == $cc) {
-                if (strstr($str, $this->edit_divider)) {
-                    $parts = explode($this->edit_divider, $str, 2);
-                    $str = $parts[1];
-                    $constants->parse($parts[0], $matchObj);
-                }
                 $this->flatSetup = [];
                 $this->flattenSetup($constants->setup, '');
                 $defaultConstants = $this->flatSetup;
@@ -1354,10 +1341,6 @@ class ExtendedTemplateService extends TemplateService
         // Works with regObjectPositions. "expands" the names of the TypoScript objects
         while (isset($this->raw[$this->rawP])) {
             $line = ltrim($this->raw[$this->rawP]);
-            if (strstr($line, $this->edit_divider)) {
-                // Resetting the objReg if the divider is found!!
-                $this->objReg = [];
-            }
             $this->rawP++;
             if ($line) {
                 if ($line[0] === '[') {
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-82425-RemoveOldTyposcriptConstantsEditorOptionMOD_TSEDITABLE_CONSTANTS.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-82425-RemoveOldTyposcriptConstantsEditorOptionMOD_TSEDITABLE_CONSTANTS.rst
new file mode 100644
index 000000000000..ce40a997fba4
--- /dev/null
+++ b/typo3/sysext/core/Documentation/Changelog/master/Breaking-82425-RemoveOldTyposcriptConstantsEditorOptionMOD_TSEDITABLE_CONSTANTS.rst
@@ -0,0 +1,32 @@
+.. include:: ../../Includes.txt
+
+==================================================================================================
+Breaking: #82425 - Remove old typoscript constants editor option "###MOD_TS:EDITABLE_CONSTANTS###"
+==================================================================================================
+
+See :issue:`82425`
+
+Description
+===========
+
+The special functionality on the constant comment `###MOD_TS:EDITABLE_CONSTANTS###`
+has been dropped. This rarely used feature makes this comment a casual
+comment without further added features.
+
+A public property of PHP class has been dropped together with that removal:
+
+* Property :php:`TYPO3\CMS\Core\TypoScript\ExtendedTemplateService->edit_divider`
+
+
+Impact
+======
+
+The constants editor does not show constants before the comment `###MOD_TS:EDITABLE_CONSTANTS###` anymore as default constants.
+
+
+Affected Installations
+======================
+
+All installations which have configured the constants comment `###MOD_TS:EDITABLE_CONSTANTS###`. Since this has been a widely unknown feature, most instances should not be affected.
+
+.. index:: Backend, TypoScript, PartiallyScanned
diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyPublicMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyPublicMatcher.php
index 15010cd28732..b32b4e880003 100644
--- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyPublicMatcher.php
+++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyPublicMatcher.php
@@ -184,6 +184,11 @@ return [
             'Breaking-82398-RemoveSpecialConstantTSConstantEditor.rst',
         ],
     ],
+    'TYPO3\CMS\Core\TypoScript\ExtendedTemplateService->edit_divider' => [
+        'restFiles' => [
+            'Breaking-82425-RemoveOldTyposcriptConstantsEditorOptionMOD_TSEDITABLE_CONSTANTS.rst',
+        ],
+    ],
 
     // Deprecated public properties
 ];
diff --git a/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateConstantEditorModuleFunctionController.php b/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateConstantEditorModuleFunctionController.php
index 4de03c7e5b8c..9ed409fb9bc3 100644
--- a/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateConstantEditorModuleFunctionController.php
+++ b/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateConstantEditorModuleFunctionController.php
@@ -76,7 +76,7 @@ class TypoScriptTemplateConstantEditorModuleFunctionController extends AbstractF
             $this->constants = $this->templateService->generateConfig_constants();
             // The returned constants are sorted in categories, that goes into the $tmpl->categories array
             $this->templateService->ext_categorizeEditableConstants($this->constants);
-            // This array will contain key=[expanded constant name], value=line number in template. (after edit_divider, if any)
+            // This array will contain key=[expanded constant name], value=line number in template.
             $this->templateService->ext_regObjectPositions($this->templateRow['constants']);
             return true;
         }
-- 
GitLab