Deprecation: #99615 - GeneralUtility::_GPmerged()
See forge#99615
Description
The method
\TYPO3\
has
been marked as deprecated and should not be used any longer.
Modern code should access GET
and POST
data from the PSR-7
\Psr\
, and should avoid accessing
super-globals
$_
and
$_
directly. This helps creating
controller classes with a clean architecture. Some
\TYPO3\
related helper methods like
_GPmerged
violate this, using them is considered a technical debt.
They are being phased out.
Impact
Calling the method will raise a deprecation level log error and will stop working with TYPO3 v13.
Affected installations
Instances with extensions using
General
are affected.
The extension scanner will find usages with a strong match.
Migration
General
is a helper method that retrieves
request parameters and returns the value, while POST
parameters take
precedence over GET
parameters, if both exist.
The same result can be achieved by retrieving arguments from the request object.
An instance of the PSR-7
Server
is handed over to
controllers by TYPO3 Core's PSR-15
\TYPO3\
and middleware implementations, and is available in various related scopes
like the frontend
\TYPO3\
.
Typical code:
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\ArrayUtility;
// Before
$getMergedWithPost = GeneralUtility::_GPmerged('tx_scheduler');
// After
$getMergedWithPost = $request->getQueryParams()['tx_scheduler'];
ArrayUtility::mergeRecursiveWithOverrule($getMergedWithPost, $request->getParsedBody()['tx_scheduler']);