Deprecation: #88854 - T3_THIS_LOCATION

See forge#88854

Description

The global JavaScript variable T3_THIS_LOCATION containing the URL to the current document (if not modified) 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.

Some PHP API uses T3_THIS_LOCATION (e.g. \TYPO3\CMS\Backend\Utility\BackendUtility::getLinkToDataHandlerAction() with second argument being -1) which has been marked as deprecated as well.

Affected Installations

All third party extensions using T3_THIS_LOCATION are affected.

Migration

When generating URLs containing a returnUrl (a common use-case for T3_THIS_LOCATION), consider using either rawurldecode(GeneralUtility::getIndpEnv('REQUEST_URI')) or normalizedParams in the PSR-7 ServerRequest object: $request->getAttribute('normalizedParams')->getRequestUri().

In general, onclick handlers doing a redirect are considered bad practice. Use HTML's href attribute and attach custom click handlers, if necessary.