[TASK] Deprecate `T3_RETURN_URL` 90/61390/2
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Tue, 30 Jul 2019 12:48:04 +0000 (14:48 +0200)
committerFrank Naegler <frank.naegler@typo3.org>
Tue, 30 Jul 2019 13:39:24 +0000 (15:39 +0200)
The global JavaScript variable `T3_RETURN_URL` containing the returnUrl
sent either via GET or POST has been marked as deprecated.

Resolves: #88862
Releases: master
Change-Id: I77e94932ef117428100dcd413380940ff33a9b9a
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61390
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
typo3/sysext/backend/Classes/Template/DocumentTemplate.php
typo3/sysext/backend/Classes/Template/ModuleTemplate.php
typo3/sysext/core/Documentation/Changelog/master/Deprecation-88862-T3_RETURN_URL.rst [new file with mode: 0644]

index 8088b92..de8e4f8 100644 (file)
@@ -362,6 +362,7 @@ function jumpToUrl(URL) {
             'popViewId' => ''
         ]);
         $out = '
+       // @deprecated
        var T3_RETURN_URL = ' . GeneralUtility::quoteJSvalue(str_replace('%20', '', rawurlencode(GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'))))) . ';
        var T3_THIS_LOCATION = ' . GeneralUtility::quoteJSvalue(str_replace('%20', '', rawurlencode($thisLocation))) . '
                ';
index 8dc5d8a..b91d895 100644 (file)
@@ -649,6 +649,7 @@ class ModuleTemplate
             'popViewId' => ''
         ]);
         $out = '
+       // @deprecated
        var T3_RETURN_URL = ' . GeneralUtility::quoteJSvalue(str_replace('%20', '', rawurlencode(GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'))))) . ';
        var T3_THIS_LOCATION = ' . GeneralUtility::quoteJSvalue(str_replace('%20', '', rawurlencode($thisLocation))) . '
                ';
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-88862-T3_RETURN_URL.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-88862-T3_RETURN_URL.rst
new file mode 100644 (file)
index 0000000..aa70265
--- /dev/null
@@ -0,0 +1,42 @@
+.. include:: ../../Includes.txt
+
+===================================
+Deprecation: #88862 - T3_RETURN_URL
+===================================
+
+See :issue:`88862`
+
+Description
+===========
+
+The JavaScript variable :js:`T3_RETURN_URL` holding the returnUrl sent with the current request either via `GET` or
+`POST` has been marked as deprecated.
+
+
+Impact
+======
+
+Since this is a global JavaScript variable, no proper deprecation layer applies and thus no deprecation notice is
+rendered.
+
+
+Affected Installations
+======================
+
+All third party extensions using :js:`T3_RETURN_URL` are affected.
+
+
+Migration
+=========
+
+Get the submitted returnUrl by using PHP:
+
+.. code-block:: php
+
+   // Variant 1
+   $returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
+
+   // Variant 2
+   $returnUrl = $request->getParsedBody()['returnUrl'] ?? $request->getQueryParams()['returnUrl'] ?? '';
+
+.. index:: Backend, JavaScript, NotScanned, ext:backend