From 09b5f2b752158352821c09ee0e7e1b086274291e Mon Sep 17 00:00:00 2001 From: Benni Mack <benni@typo3.org> Date: Wed, 20 Nov 2019 19:30:43 +0100 Subject: [PATCH] [TASK] Deprecate TSFE->divSection DivSection was used to create GMENU_LAYERS functionality, injecting global inline JavaScript right after the rendered pages' <body> tag. GMENU_LAYERS was removed with TYPO3 v8, however the property was still replaced every single time in the TYPO3 Frontend when a USER_INT was on the page. This is not needed anymore, marking the property as unused. That's why it is deprecated. Resolves: #89722 Releases: master Change-Id: Ia8e3910e20bc28831ba3bdce143812f8acb9d139 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62347 Tested-by: TYPO3com <noreply@typo3.com> Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Tested-by: Georg Ringer <georg.ringer@gmail.com> Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Reviewed-by: Georg Ringer <georg.ringer@gmail.com> --- ...U_LAYERSRelatedPropertyTSFE-divSection.rst | 36 +++++++++++++++++++ .../TypoScriptFrontendController.php | 17 ++++++--- .../Controller/Fixtures/renderedPage.html | 3 +- .../TypoScriptFrontendControllerTest.php | 6 ++-- .../Php/PropertyPublicMatcher.php | 5 +++ 5 files changed, 58 insertions(+), 9 deletions(-) create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Deprecation-89722-GMENU_LAYERSRelatedPropertyTSFE-divSection.rst diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-89722-GMENU_LAYERSRelatedPropertyTSFE-divSection.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-89722-GMENU_LAYERSRelatedPropertyTSFE-divSection.rst new file mode 100644 index 000000000000..1b8add2c0140 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-89722-GMENU_LAYERSRelatedPropertyTSFE-divSection.rst @@ -0,0 +1,36 @@ +.. include:: ../../Includes.txt + +==================================================================== +Deprecation: #89722 - GMENU_LAYERS related property TSFE->divSection +==================================================================== + +See :issue:`89722` + +Description +=========== + +The public PHP property :php:`TypoScriptFrontendController->divSection` has been marked as deprecated. This was used in prior +TYPO3 versions to add dynamic JavaScript related to GMENU_LAYERS +functionality which was removed with previous TYPO3 versions, making +this property only produce unnecessary overhead in frontend rendering. + + +Impact +====== + +Accessing or setting this property will trigger a deprecation notice. + + +Affected Installations +====================== + +TYPO3 installations with extensions explicitly accessing this property, which is highly unlikely as this property is very lowlevel. + + +Migration +========= + +If there is a need to add JavaScript within uncached content, use +:php:`$GLOBALS['TSFE']->additionalHeaderData[]` instead. + +.. index:: Frontend, FullyScanned, ext:frontend \ No newline at end of file diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php index 27b6dd9389e9..efd8180d6a35 100644 --- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php +++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php @@ -398,6 +398,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface /** * Used to accumulate DHTML-layers. * @var string + * @deprecated since TYPO3 v10.2, will be removed in TYPO3 v11, use custom USER_INT objects instead. */ public $divSection = ''; @@ -2952,7 +2953,6 @@ class TypoScriptFrontendController implements LoggerAwareInterface : []; $this->additionalJavaScript = $this->config['INTincScript_ext']['additionalJavaScript'] ?? null; $this->additionalCSS = $this->config['INTincScript_ext']['additionalCSS'] ?? null; - $this->divSection = ''; if (empty($this->config['INTincScript_ext']['pageRenderer'])) { $this->initPageRenderer(); } else { @@ -2971,12 +2971,10 @@ class TypoScriptFrontendController implements LoggerAwareInterface [ '<!--HD_' . $this->config['INTincScript_ext']['divKey'] . '-->', '<!--FD_' . $this->config['INTincScript_ext']['divKey'] . '-->', - '<!--TDS_' . $this->config['INTincScript_ext']['divKey'] . '-->' ], [ $this->convOutputCharset(implode(LF, $this->additionalHeaderData)), $this->convOutputCharset(implode(LF, $this->additionalFooterData)), - $this->convOutputCharset($this->divSection), ], $this->pageRenderer->renderJavaScriptAndCssForProcessingOfUncachedContentObjects($this->content, $this->config['INTincScript_ext']['divKey']) ); @@ -3082,7 +3080,6 @@ class TypoScriptFrontendController implements LoggerAwareInterface $this->additionalHeaderData = ['<!--HD_' . $this->config['INTincScript_ext']['divKey'] . '-->']; // Clearing the array $this->additionalFooterData = ['<!--FD_' . $this->config['INTincScript_ext']['divKey'] . '-->']; - $this->divSection .= '<!--TDS_' . $this->config['INTincScript_ext']['divKey'] . '-->'; } else { // Add javascript in a "regular" fashion $jsCode = trim($this->JSCode); @@ -4024,6 +4021,9 @@ class TypoScriptFrontendController implements LoggerAwareInterface case 'sys_language_isocode': trigger_error('Property $TSFE->sys_language_isocode is not in use anymore as this information is now stored within the SiteLanguage object. Will be removed in TYPO3 v11.0.', E_USER_DEPRECATED); return isset($this->$propertyName); + case 'divSection': + trigger_error('Property $TSFE->divSection is not in use anymore. Will be removed in TYPO3 v11.0.', E_USER_DEPRECATED); + return isset($this->$propertyName); case 'fePreview': trigger_error('Property $TSFE->fePreview is not in use anymore as this information is now stored within the FrontendPreview aspect.', E_USER_DEPRECATED); return $this->context->hasAspect('frontend.preview'); @@ -4059,6 +4059,9 @@ class TypoScriptFrontendController implements LoggerAwareInterface case 'sys_language_isocode': trigger_error('Property $TSFE->sys_language_isocode is not in use anymore as this information is now stored within the SiteLanguage object. Will be removed in TYPO3 v11.0.', E_USER_DEPRECATED); return $this->sys_language_isocode ?? $this->language->getTwoLetterIsoCode(); + case 'divSection': + trigger_error('Property $TSFE->divSection is not in use anymore. Will be removed in TYPO3 v11.0.', E_USER_DEPRECATED); + break; case 'fePreview': trigger_error('Property $TSFE->fePreview is not in use anymore as this information is now stored within the FrontendPreview aspect.', E_USER_DEPRECATED); if ($this->context->hasAspect('frontend.preview')) { @@ -4101,6 +4104,9 @@ class TypoScriptFrontendController implements LoggerAwareInterface case 'sys_language_isocode': trigger_error('Property $TSFE->sys_language_isocode is not in use anymore as this information is now stored within the SiteLanguage object. Will be removed in TYPO3 v11.0.', E_USER_DEPRECATED); break; + case 'divSection': + trigger_error('Property $TSFE->divSection is not in use anymore. Will be removed in TYPO3 v11.0.', E_USER_DEPRECATED); + break; case 'fePreview': trigger_error('Property $TSFE->fePreview is not in use anymore as this information is now stored within the FrontendPreview aspect.', E_USER_DEPRECATED); $this->context->setAspect('frontend.preview', GeneralUtility::makeInstance(PreviewAspect::class, (bool)$propertyValue)); @@ -4133,6 +4139,9 @@ class TypoScriptFrontendController implements LoggerAwareInterface case 'sys_language_isocode': trigger_error('Property $TSFE->sys_language_isocode is not in use anymore as this information is now stored within the SiteLanguage object. Will be removed in TYPO3 v11.0.', E_USER_DEPRECATED); break; + case 'divSection': + trigger_error('Property $TSFE->divSection is not in use anymore. Will be removed in TYPO3 v11.0.', E_USER_DEPRECATED); + break; case 'fePreview': trigger_error('Property $TSFE->fePreview is not in use anymore as this information is now stored within the FrontendPreview aspect.', E_USER_DEPRECATED); $this->context->setAspect('frontend.preview', GeneralUtility::makeInstance(PreviewAspect::class, false)); diff --git a/typo3/sysext/frontend/Tests/Unit/Controller/Fixtures/renderedPage.html b/typo3/sysext/frontend/Tests/Unit/Controller/Fixtures/renderedPage.html index 492020243f54..412deeef94f7 100644 --- a/typo3/sysext/frontend/Tests/Unit/Controller/Fixtures/renderedPage.html +++ b/typo3/sysext/frontend/Tests/Unit/Controller/Fixtures/renderedPage.html @@ -14,7 +14,7 @@ <title>powermail</title> -<meta name="generator" content="TYPO3 6.0 CMS"> +<meta name="generator" content="TYPO3 10.4 CMS"> <link rel="stylesheet" type="text/css" href="typo3temp/assets/css/427bb03fe1.css?1334416344" media="all"> @@ -26,7 +26,6 @@ <!--HD_679b52796e75d474ccbbed486b6837ab--> </head> <body> -<!--TDS_679b52796e75d474ccbbed486b6837ab--> <!-- CONTENT ELEMENT, uid:65/login [begin] --> <div id="c65" class="csc-default csc-space-before- csc-space-after-"><!--INT_SCRIPT.13e1737dd0938292520612f3088602ba--></div> diff --git a/typo3/sysext/frontend/Tests/Unit/Controller/TypoScriptFrontendControllerTest.php b/typo3/sysext/frontend/Tests/Unit/Controller/TypoScriptFrontendControllerTest.php index 49ff737cf386..30128ff59110 100644 --- a/typo3/sysext/frontend/Tests/Unit/Controller/TypoScriptFrontendControllerTest.php +++ b/typo3/sysext/frontend/Tests/Unit/Controller/TypoScriptFrontendControllerTest.php @@ -79,7 +79,7 @@ class TypoScriptFrontendControllerTest extends UnitTestCase /** * This is the callback that mimics a USER_INT extension */ - public function INTincScript_processCallback() + public function processNonCacheableContentPartsAndSubstituteContentMarkers() { $GLOBALS['TSFE']->additionalHeaderData[] = 'headerData'; $GLOBALS['TSFE']->additionalFooterData[] = 'footerData'; @@ -96,13 +96,13 @@ class TypoScriptFrontendControllerTest extends UnitTestCase /** @var \PHPUnit\Framework\MockObject\MockObject|TypoScriptFrontendController $tsfe */ $tsfe = $this->getMockBuilder(TypoScriptFrontendController::class) ->setMethods([ - 'INTincScript_process', + 'processNonCacheableContentPartsAndSubstituteContentMarkers', 'INTincScript_loadJSCode', 'setAbsRefPrefix', 'regeneratePageTitle' ])->disableOriginalConstructor() ->getMock(); - $tsfe->expects(self::exactly(2))->method('processNonCacheableContentPartsAndSubstituteContentMarkers')->willReturnCallback([$this, 'INTincScript_processCallback']); + $tsfe->expects(self::exactly(2))->method('processNonCacheableContentPartsAndSubstituteContentMarkers')->willReturnCallback([$this, 'processNonCacheableContentPartsAndSubstituteContentMarkers']); $tsfe->content = file_get_contents(__DIR__ . '/Fixtures/renderedPage.html'); $config = [ 'INTincScript_ext' => [ diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyPublicMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyPublicMatcher.php index 7acf792f269c..fa57ffd179e2 100644 --- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyPublicMatcher.php +++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyPublicMatcher.php @@ -631,4 +631,9 @@ return [ 'Deprecation-89127-CleanupRecordHistoryHandling.rst', ], ], + 'TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->divSection' => [ + 'restFiles' => [ + 'Deprecation-89722-GMENU_LAYERSRelatedPropertyTSFE-divSection.rst', + ], + ], ]; -- GitLab