85138[FEATURE] Allow argument mapping exception-handling in ActionController
Commit message
Review
-
Code review CR +2 Done
- Garvin Hicking +2
- Markus Klein +1
- Mathias Brodala +1
- Simon Schaufelberger +1
-
Verified V +2 Done
- Garvin Hicking +2
- Markus Klein +1
- Simon Schaufelberger +1
- core-ci +1 CI
Issues 1
Files 5
- typo3/sysext/core/Documentation/Changelog/13.3/Feature-104321-AllowHandlingOfArgumentMappingExceptionsInActionController.rst19new+58 −0
- typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php6+41 −9
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Classes/Controller/BlogController.php+5 −17
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/ext_localconf.php+1 −1
- typo3/sysext/extbase/Tests/Functional/Mvc/Controller/ControllerArgumentsMappingTest.php2+79 −0
Review log 5668
Show 3343 earlier messages
-
Torben Hansen uploaded patch set 1 07/06/24, 11:56
-
core-ci voted on patch set 1 V -1 07/06/24, 12:01 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61095
-
Torben Hansen uploaded patch set 2
V -107/07/24, 13:10 -
core-ci voted on patch set 2 V +1 07/07/24, 13:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61138
-
Torben Hansen uploaded patch set 3
V +107/07/24, 17:46 -
core-ci voted on patch set 3 V +1 07/07/24, 17:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61141
-
Mogens Fiebrandt commented on patch set 3 07/08/24, 02:30
-
Torben Hansen uploaded patch set 4
V +107/08/24, 06:21 -
Torben Hansen commented on patch set 3 07/08/24, 06:21
Feature-104321-AllowHandlingOfArgumentMappingExceptionsInActionController.rst:22ReplyDone -
core-ci voted on patch set 4 V +1 07/08/24, 06:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61160
-
Mogens Fiebrandt voted on patch set 4 CR +1 07/08/24, 08:57
-
Christian Kuhn commented on patch set 4 07/08/24, 14:45
ActionController.php:769still a bit unsure on the general patch, but what pops up immediately: why is this public? -
Torben Hansen uploaded patch set 5
CR +1V +107/08/24, 16:16 -
Torben Hansen commented on patch set 5 07/08/24, 16:19
ActionController.php:769ReplyUops, the method should be `protected`, as only classed extending `ActionController` should be able to use/overwrite the method. Updated the patch. -
core-ci voted on patch set 5 V +1 07/08/24, 16:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61181
-
Daniel Goerz commented on patch set 5 07/16/24, 22:47
Feature-104321-AllowHandlingOfArgumentMappingExceptionsInActionController.rst:25exceptions -
Georg Ringer commented on patch set 6
V +107/17/24, 05:16Published edit on patch set 5. -
Georg Ringer commented on patch set 6 CR +1 V +1 07/17/24, 05:17
Feature-104321-AllowHandlingOfArgumentMappingExceptionsInActionController.rst:25ReplyDone -
core-ci voted on patch set 6 V +1 07/17/24, 05:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61674
-
Mogens Fiebrandt voted on patch set 6 CR +1 07/17/24, 07:58
-
Daniel Goerz commented on patch set 6 07/17/24, 08:12
Hi Torben, I welcome the idea of this patch, as this is something I frequently have to deal with. What do you think about handling the exception in the processRequest() method via try-catch block, so that existing overrides of mapRequestArgumentsToControllerArguments() do not silently switch to the new handling without noticing? -
Torben Hansen commented on patch set 6 07/18/24, 05:54
Reply
I had it in `processRequest()` first, but decided to leave the try/catch block out of that function, since I think `processRequest()` should be as simple/readable as possible. Users overriding the internal function `mapRequestArgumentsToControllerArguments` will however not silently switch to the new handling (except they call `parent::mapRequestArgumentsToControllerArguments`) and currently, only exceptions are catched, it the new configuration options are set. Main intention of this patch is to give extension authors a public API which allows custom exception handling in case of argument mapping errors and without the need to override internal functions. -
Daniel Goerz commented on patch set 6 07/22/24, 15:20
Reply
My thinking was: If you currently handle this yourself, you probably have an override of `mapRequestArgumentsToControllerArguments()` in place to catch exceptions thrown there (the override of course is calling parent). If you switch to the new default behaviour of always responding with 404 (by setting the new option, so it not silent, I aggree), you have to change your override to an override of `handleArgumentMappingExceptions()` whenever you want to change the default behaviour on a per controller base. However this is by no means crucial. The extra effort is very manageable and custom overrides are phrone to breaking in major updates anyway. So, fine with me to keep it as is. -
Daniel Goerz voted on patch set 6 CR +1 07/22/24, 15:21
-
Garvin Hicking uploaded patch set 7
CR +1V +109/04/24, 15:55Rebase and minor wording changes -
Garvin Hicking commented on patch set 7 09/04/24, 15:56
Rebased set and minor spelling adjustments.ActionController.php:785In this case we have the same exception code for two possible exceptions. I wonder if it would be beneficial to have distinct codes instead? -
Garvin Hicking voted on patch set 7 CR +1 09/04/24, 15:57
-
core-ci voted on patch set 7 V +1 09/04/24, 16:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64783
-
Chris Müller commented on patch set 7 09/04/24, 16:37
Feature-104321-AllowHandlingOfArgumentMappingExceptionsInActionController.rst:25I assume, this is TypoScript configuration? To make it for integrators easier reading this changelog, maybe we should hint that ("... can be enabled by TypoScript"). What do you think?Feature-104321-AllowHandlingOfArgumentMappingExceptionsInActionController.rst:34Suggestion: When setting one of these options to 1 ... -
Garvin Hicking commented on patch set 7 09/05/24, 09:11
See https://forge.typo3.org/issues/104828 for a related thing to address (request should set a http/5xx error when thrown and not caught? -
Garvin Hicking commented on patch set 8
CR +1V +109/05/24, 16:08Published edit on patch set 7. -
Garvin Hicking commented on patch set 8 CR +1 09/05/24, 16:09
Feature-104321-AllowHandlingOfArgumentMappingExceptionsInActionController.rst:25ReplyDoneFeature-104321-AllowHandlingOfArgumentMappingExceptionsInActionController.rst:34ReplyDone -
core-ci voted on patch set 8 V +1 09/05/24, 16:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64871
-
Georg Ringer voted on patch set 8 CR +1 09/06/24, 08:39
-
Torben Hansen commented on patch set 8 09/10/24, 07:13
Reply
The references issue #104828 is not extbase related and should therefore not be addressed within this patch.ActionController.php:785ReplyThe exceptions are catched on intention and triggers the configured page not found error handler. AFAIK there is no possibility to "do something" with the exception code at this level, since just the general TYPO3 404 response is generated. So I think it is ok to have one exception code here. -
Garvin Hicking commented on patch set 8 V +1 09/10/24, 08:26
Reply
OK; I seem to have misread that - I thought the current exception would still yield a HTTP(verified working; please see comment on "naming things" and the docs)Feature-104321-AllowHandlingOfArgumentMappingExceptionsInActionController.rst:27I think this should be `plugin.tx_yourextension.mvc...` here? If you copy+paste this one to a TypoScript configuration it won't apply.Feature-104321-AllowHandlingOfArgumentMappingExceptionsInActionController.rst:28Regarding "naming things". We already have a setting called "throwPageNotFoundExceptionIfActionCantBeResolved". So I think we should also prefix this with "throw" here, which also makes the intent clearer why one needs to set it to "1" to take effect (and 0 to disable it and receive the actual exception)...? -
Torben Hansen uploaded patch set 9
CR +1V +109/10/24, 08:38 -
Torben Hansen commented on patch set 8 09/10/24, 08:43
Feature-104321-AllowHandlingOfArgumentMappingExceptionsInActionController.rst:27ReplyGood spot. I separated this, so we now show the global configuration option and on extension basis.Feature-104321-AllowHandlingOfArgumentMappingExceptionsInActionController.rst:28ReplyI do not agree here. Although we from a technical perspective throw an exception, the result will not be, that TYPO3 shows an exception. Instead, the general 404 error (either from TYPO3 or the PageErrorHandler if configured) will be shown, so I think the current naming fits better. We could prefix it with "show" (showPageNotFoundIfActionCantBeResolved), which would make it more clear. What do you think? -
core-ci voted on patch set 9 V +1 09/10/24, 08:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/65193
-
Garvin Hicking commented on patch set 9 09/10/24, 10:57
Feature-104321-AllowHandlingOfArgumentMappingExceptionsInActionController.rst:28ReplyYes, "show" would work well for me to get my mind wrapped about what "0" or "1" actually means :-) -
Torben Hansen uploaded patch set 10
V +109/10/24, 12:23 -
Torben Hansen commented on patch set 10 09/10/24, 12:23
Feature-104321-AllowHandlingOfArgumentMappingExceptionsInActionController.rst:28ReplyDone -
core-ci voted on patch set 10 V +1 09/10/24, 12:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/65236
-
Garvin Hicking commented on patch set 10 CR +1 V +1 09/10/24, 12:55
👍 -
Markus Klein commented on patch set 10 09/10/24, 13:06
Feature-104321-AllowHandlingOfArgumentMappingExceptionsInActionController.rst:28isn't this `config.tx_extbase`? \TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager::getExtbaseConfiguration -
Markus Klein commented on patch set 10 09/10/24, 13:07
ActionController.php:817What happens if this is triggered within a BE module? -
Torben Hansen commented on patch set 10 09/10/24, 13:19
Feature-104321-AllowHandlingOfArgumentMappingExceptionsInActionController.rst:28ReplyGood spot.ActionController.php:817ReplyIn this case, also a 404 (page not found) is shown instead of the exception. Most likely not the best to show a 404 here, but extension authors could now override `handleArgumentMappingExceptions` to handle those scenarios in BE modules. -
Garvin Hicking commented on patch set 11
CR +1V +109/10/24, 14:06Published edit on patch set 10. -
Garvin Hicking voted on patch set 11 CR +1 V +1 09/10/24, 14:07
-
core-ci voted on patch set 11 V +1 09/10/24, 14:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/65257
-
Markus Klein voted on patch set 11 CR +1 09/10/24, 18:26
-
Stefan Froemken commented on patch set 11 09/10/24, 21:07
Nice oneControllerArgumentsMappingTest.php:136Duplicate "Exception"? -
Garvin Hicking commented on patch set 11 09/10/24, 21:12
ControllerArgumentsMappingTest.php:136ReplyThe name is "TargetNotFoundException", which is an Exception ("TargetNotFoundException"-Exception), so technically this is alright, albeit funny. :) -
Garvin Hicking commented on patch set 11 09/10/24, 21:12
Reply
Acknowledged -
Stefan Froemken voted on patch set 11 CR +1 09/10/24, 21:29
-
Simon Schaufelberger voted on patch set 11 CR +1 V +1 09/11/24, 09:48
-
Thomas Hohn voted on patch set 11 CR +1 09/11/24, 09:56
-
Mathias Brodala commented on patch set 11 09/13/24, 07:43
Feature-104321-AllowHandlingOfArgumentMappingExceptionsInActionController.rst:34Should we mention that this can also be configured per-plugin as "3rd level"? E.g. > plugin.tx_yourextension_firstplugin.mvc.showPageNotFoundIfTargetNotFoundException = 1 -
Sebastian Iffland voted on patch set 11 CR +1 09/13/24, 07:56
-
Garvin Hicking commented on patch set 11 09/13/24, 08:32
Feature-104321-AllowHandlingOfArgumentMappingExceptionsInActionController.rst:34ReplyYes, I'd say so. I can adress it once I get over losing all votes because of it 🥲 -
Garvin Hicking commented on patch set 12
CR +1V +109/13/24, 08:35Published edit on patch set 11. -
Garvin Hicking commented on patch set 12 CR +1 V +1 09/13/24, 08:35
Feature-104321-AllowHandlingOfArgumentMappingExceptionsInActionController.rst:34ReplyDone -
Mathias Brodala voted on patch set 12 CR +1 09/13/24, 08:37
-
core-ci voted on patch set 12 V +1 09/13/24, 08:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/65638
-
Markus Klein voted on patch set 12 CR +1 V +1 09/13/24, 08:47
-
Simon Schaufelberger voted on patch set 12 CR +1 V +1 09/13/24, 08:54
-
Garvin Hicking voted on patch set 12 CR +2 V +2 09/13/24, 09:25
-
Garvin Hicking merged patch set 13 09/13/24, 09:39
Feature-104321-AllowHandlingOfArgumentMappingExceptionsInActionController.rst:22