Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Deprecate extbase StopActionException
There are three possible cases an extbase controller action can come up with: a) Return a casual psr-7 response (html, json, ...) b) Return an extbase specific ForwardResponse to dispatch extbase-internally to another action. c) Have a redirect the client should receive to call some other Url. a) and b) are simple in v11 - the action returns a PSR-7 ResponseInterface. c) however throws StopActionException instead, which is caught by extbase Dispatcher and then returned. This is ugly. The patch changes this and deprecates the StopActionException. We can not drop the throw call since that would be breaking, but we prepare towards a clean v12 solution, which leads to the sitation that *all* extbase actions return a response. Resolves: #94351 Releases: master Change-Id: Ie5a53109959a008ab1666f52d5a81e6e7ba3efdb Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/69498 Tested-by: core-ci <typo3@b13.com> Tested-by: Daniel Goerz <daniel.goerz@posteo.de> Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de> Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
- Loading branch information
Showing
8 changed files
with
110 additions
and
50 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
...umentation/Changelog/master/Deprecation-94351-ExtextbaseStopActionException.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
.. include:: ../../Includes.txt | ||
|
||
===================================================== | ||
Deprecation: #94351 - ext:extbase StopActionException | ||
===================================================== | ||
|
||
See :issue:`94351` | ||
|
||
Description | ||
=========== | ||
|
||
To further prepare towards clean PSR-7 Request / Response handling in | ||
extbase, the extbase internal :php:`TYPO3\CMS\Extbase\Mvc\Exception\StopActionException` | ||
has been deprecated. | ||
|
||
|
||
Impact | ||
====== | ||
|
||
No deprecation is logged, but the :php:`StopActionException` will be | ||
removed in v12 as breaking change. Extension developers with extbase | ||
based controllers can prepare in v11 towards this. | ||
|
||
|
||
Affected Installations | ||
====================== | ||
|
||
Extensions with extbase controllers that throw :php:`StopActionException` or | ||
use methods :php:`redirect` or :php:`redirectToUri` from extbase :php:`ActionController` | ||
are affected. | ||
|
||
|
||
Migration | ||
========= | ||
|
||
As a goal, extbase actions will *always* return a :php:`ResponseInterface` | ||
in v12. v11 prepares towards this, but still throws the :php:`StopActionException` | ||
in :php:`redirectToUri`. Developers should prepare towards this, however. | ||
|
||
Example before: | ||
|
||
.. code-block:: php | ||
public function fooAction() | ||
{ | ||
$this->redirect('otherAction'); | ||
} | ||
Example compatible with v10, v11 and v12 - IDE's and static code analyzers | ||
may complain in v10 and v11, though: | ||
|
||
.. code-block:: php | ||
public function fooAction(): ResponseInterface | ||
{ | ||
// A return is added! | ||
return $this->redirect('otherAction'); | ||
} | ||
.. index:: PHP-API, NotScanned, ext:extbase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters