Commit 6174289d authored by Łukasz Uznański's avatar Łukasz Uznański Committed by Jan Helke
Browse files

[TASK] Use ServerRequestInterface in UserSettingsController

* deprecate public (non-routed) methods

Resolves: #84369
Releases: master
Change-Id: I79f11a8d6e787886b9bd3bfef9e4520c9b5979b7
Reviewed-on: https://review.typo3.org/56332

Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Mathias Brodala's avatarMathias Brodala <mbrodala@pagemachine.de>
Tested-by: Mathias Brodala's avatarMathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: Jan Helke's avatarJan Helke <typo3@helke.de>
Tested-by: Jan Helke's avatarJan Helke <typo3@helke.de>
parent f9ac3141
<?php
declare(strict_types = 1);
namespace TYPO3\CMS\Backend\Controller;
/*
......@@ -49,10 +49,10 @@ class UserSettingsController
public function processAjaxRequest(ServerRequestInterface $request): ResponseInterface
{
// do the regular / main logic, depending on the action parameter
$action = $request->getParsedBody()['action'] ?? $request->getQueryParams()['action'];
$key = $request->getParsedBody()['key'] ?? $request->getQueryParams()['key'];
$value = $request->getParsedBody()['value'] ?? $request->getQueryParams()['value'];
$data = $this->process($action, $key, $value);
$action = $request->getParsedBody()['action'] ?? $request->getQueryParams()['action'] ?? '';
$key = $request->getParsedBody()['key'] ?? $request->getQueryParams()['key'] ?? '';
$value = $request->getParsedBody()['value'] ?? $request->getQueryParams()['value'] ?? '';
$data = $this->processRequest($action, $key, $value);
return (new JsonResponse())->setPayload($data);
}
......@@ -64,8 +64,24 @@ class UserSettingsController
* @param string $key
* @param string $value
* @return mixed
*
* @deprecated since v9, will be removed in v10
*/
public function process($action, $key = '', $value = '')
{
trigger_error('Method process() will be replaced by protected method processRequest() in v10. Do not call from other extensions', E_USER_DEPRECATED);
return $this->processRequest($action, $key, $value);
}
/**
* Process data
*
* @param string $action
* @param string $key
* @param mixed $value
* @return mixed
*/
protected function processRequest(string $action, string $key = '', $value = '')
{
switch ($action) {
case 'get':
......
.. include:: ../../Includes.txt
=================================================================================
Deprecation: #84369 - Protected methods and properties in UserSettingsController
=================================================================================
See :issue:`84369`
Description
===========
This file is about third party usage (consumer that call the class as well as
signals or hooks depending on it) of :php:`TYPO3\CMS\Backend\Controller\UserSettingsController`.
All methods not used as entry points by :php:`TYPO3\CMS\Backend\Http\RouteDispatcher` will be
removed or set to protected in v10 and throw deprecation warnings if used from a third party:
* [not scanned] :php:`process()`
Impact
======
Calling above method on an instance of :php:`UserSettingsController` will throw a deprecation warning in v9 and a PHP fatal in v10.
Affected Installations
======================
The extension scanner will find all usages, but may also find some false positives.
Migration
=========
In general, extensions should not instantiate and re-use controllers of the core. Existing
usages should be rewritten to be free of calls like these.
.. index:: Backend, PHP-API, PartiallyScanned
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment