89080[FEATURE] Improve default validation error in Controllers
Commit message
Review
-
Code review CR 0
-
Verified V -1
- Torben Hansen -1
- core-ci +1 CI
Issues 2
Files 4
- typo3/sysext/core/Documentation/Changelog/14.1/Feature-106462-ImproveFailedValidationErrorHandlingInExtbaseActionController.rstnew+52 −0
- typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php18+57 −8
- typo3/sysext/extbase/Resources/Private/Language/locallang.xlf+6 −0
- typo3/sysext/extbase/Tests/Functional/Mvc/Controller/BlogPostEditingControllerTest.php2+1 −1
Review log 4965
Show 3240 earlier messages
-
Lina Wolf uploaded patch set 1 04/12/25, 06:55
-
Lina Wolf uploaded patch set 2 04/12/25, 06:59
-
core-ci voted on patch set 1 V -1 04/12/25, 07:06 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77607
-
core-ci voted on patch set 2 V -1 04/12/25, 07:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77608
-
Lina Wolf uploaded patch set 3
V -104/12/25, 07:23 -
core-ci voted on patch set 3 V +1 04/12/25, 07:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77610
-
Mathias Bolt Lesniak commented on patch set 3 04/12/25, 13:26
A nice UX improvement, I think. I suggested some improvements to the change log entry.Feature-106462-ConfigurableAndUser-friendlyErrorFlashMessagesInActionController.rst:17```suggestion A localizable, user-friendly message will now be displayed by default: Something went wrong while processing your request. Please try again. This replaces highly technical messages that expose class/method names, like: ```Feature-106462-ConfigurableAndUser-friendlyErrorFlashMessagesInActionController.rst:21```suggestion ``` The suggestion above makes this line unnecessary and avoids breaking the sentence up across paragraphs.Feature-106462-ConfigurableAndUser-friendlyErrorFlashMessagesInActionController.rst:24```suggestion automatic flash messages on a site-by-site basis or using TypoScript: ```Feature-106462-ConfigurableAndUser-friendlyErrorFlashMessagesInActionController.rst:30```suggestion The default error flash message can now be suppressed without ```Feature-106462-ConfigurableAndUser-friendlyErrorFlashMessagesInActionController.rst:31```suggestion overriding the ActionController class. ``` More specific?Feature-106462-ConfigurableAndUser-friendlyErrorFlashMessagesInActionController.rst:33```suggestion Validation errors are now stored in the ActionController's protected property ```Feature-106462-ConfigurableAndUser-friendlyErrorFlashMessagesInActionController.rst:34```suggestion `$this->lastValidationResult`. This makes further processing and debugging easier. ```Feature-106462-ConfigurableAndUser-friendlyErrorFlashMessagesInActionController.rst:41```suggestion * Integrators can disable default error flash messages globally or per site. ``` Also, is "globally or per site" a too limited statement? Since TypoScript can be applied to e.g., any page, tree section, or condition, it is not limited to this. Or?ActionController.php:577Is "globally or per site" a too limited statement? Since TypoScript can be applied to e.g., any page, tree section, or condition, it is not limited to this. -
Garvin Hicking commented on patch set 3 04/12/25, 14:20
How about emitting the current error message while n development context? I always kind of found it helpful while debugging to spot the actual controller and action name here.BlogPostEditingControllerTest.php:560we should add a testcase to this, with typoscript disabling default message, to verify this works -
Stefan Bürk commented on patch set 3 04/12/25, 15:35
ActionController.php:437Please do not park the validation result in a property (state). Keep it here as local variable and pass it down to the error action (L450) ``` $actionResult = $this->{$this->errorMethodName}($validationResult); ``` and further to nested calls. Passing information is the better than property transport.ActionController.php:586This method should get the validation result passed in (nullable?) and not rely on a parked property state.ActionController.php:588Do we really need a new feature flag for it ? Why not simply `improving` the situation, what the core of this change aims for, and make it the default. And then again, the multi level flag setting every has an other opionen which should overrule what and so on. Could that simply be left out ? Extbase Plugin authors can still override this method and implement it on there own if they really want to provide such a feature or hide it away. And it should be the desicion of the extbase plugin author if default or a custom message is display. Just questioning, extbase experienced developers may have more insight in this. -
Lina Wolf commented on patch set 3 04/12/25, 16:51
Feature-106462-ConfigurableAndUser-friendlyErrorFlashMessagesInActionController.rst:31ReplyYou are always extending the ActionController when you build your own Controller -
Lina Wolf marked it work in progress 04/12/25, 16:51
-
Lina Wolf commented on patch set 3 04/12/25, 17:17
Reply
How would you feel about adding it to the debug output or the log instead? While developing locally I want to make sure that the error messages shown to the end user are helpful to them? -
Garvin Hicking commented on patch set 3 04/12/25, 17:43
Reply
True. I guess putting it in the debug-level log would be good by me (no context evaluation needed, the logging context will decide this then)ActionController.php:588ReplyThis is a good point to discuss! (thinking out loud now) Extbase has some 'mvc.showPageNotFoundIfTargetNotFoundException' and 'mvc.showPageNotFoundIfRequiredArgumentIsMissingException', so maybe if we would use that scope it would be more fitting? BUT: The benefit of having this as a central flag is, that it would create the expectation to be respected in EVERY existing extension, so an integrator could configure the message then, and not the Extbase extension developer would need to code errorFlashMessageHandling individually. Then again - if extension developers actually override this method (which MANY do, myself included), then having a setting would never get evaluated and an integrator can never be sure if this setting is respected in all extensions or not. So.... the current default is not great, so I tend to agree and not overcomplicate it with a setting that might be misleading, and just make the new reporting the default. With the default referring to a translation string, integrators could also override that string, so that might be "good enough"? -
Lina Wolf commented on patch set 3 04/13/25, 06:20
ActionController.php:437ReplyAcknowledgedActionController.php:586ReplyIf we do that we are causing a fatal error to anyone who is overriding the method in their controller. Therefore overriding the method and supporting both TYPO3 v13 and 14 would not be possible anymore. Even worse we would also have to change the signature of the default error action `errorAction()`, which is frequently overridden. So if anyone was overriding one of them - and this is common practice - they could not support TYPO3 13 and 14 anymore with the same controller. Therefore, I introduced new methods now in case validation failed, falling . This also enables extension authors to separately override the general error message and the one caused by a wrongly filled out form.ActionController.php:588ReplyI will remove id for now. -
Lina Wolf uploaded patch set 4
V +104/13/25, 06:20 -
Lina Wolf commented on patch set 4 04/13/25, 06:23
This change is ready for review.Feature-106462-ConfigurableAndUser-friendlyErrorFlashMessagesInActionController.rst:17Replysection was removedFeature-106462-ConfigurableAndUser-friendlyErrorFlashMessagesInActionController.rst:21ReplyAcknowledgedFeature-106462-ConfigurableAndUser-friendlyErrorFlashMessagesInActionController.rst:24Replysection was removedFeature-106462-ConfigurableAndUser-friendlyErrorFlashMessagesInActionController.rst:30Replysection was removedFeature-106462-ConfigurableAndUser-friendlyErrorFlashMessagesInActionController.rst:31ReplyAcknowledgedFeature-106462-ConfigurableAndUser-friendlyErrorFlashMessagesInActionController.rst:33Replysection was removedFeature-106462-ConfigurableAndUser-friendlyErrorFlashMessagesInActionController.rst:34Replysection was removedFeature-106462-ConfigurableAndUser-friendlyErrorFlashMessagesInActionController.rst:41Replysection was removed -
Lina Wolf commented on patch set 4 04/13/25, 06:24
ActionController.php:577ReplyA localizable, user-friendly message will now be displayed by default: -
Lina Wolf commented on patch set 4 04/13/25, 06:25
ActionController.php:586ReplyI solved it in another way -
Lina Wolf commented on patch set 4 04/13/25, 06:26
Reply
Done -
Lina Wolf commented on patch set 4 04/13/25, 06:26
BlogPostEditingControllerTest.php:560ReplySection was removed -
Lina Wolf commented on patch set 4 04/13/25, 06:29
ActionController.php:588ReplyI wonder if we should also treat an empty error message as disabling the flash message. Then you could disable the flash message by overriding the error message with an empty string? -
core-ci voted on patch set 4 V -1 04/13/25, 06:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77667
-
Lina Wolf uploaded patch set 5
V -104/13/25, 07:18 -
Lina Wolf updated the commit message in patch set 6 04/13/25, 07:21
-
core-ci voted on patch set 5 V +1 04/13/25, 07:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77669
-
core-ci voted on patch set 6 V +1 04/13/25, 07:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77670
-
Lina Wolf updated the commit message in patch set 7
V +104/13/25, 07:43 -
core-ci voted on patch set 7 V +1 04/13/25, 07:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77671
-
Christian Kuhn commented on patch set 7 04/14/25, 12:23
Services.yaml:11these 2 lines should be avoided. why do you reconfigure global logging within this extension? -
Lina Wolf commented on patch set 8
V +104/14/25, 12:25Published edit on patch set 7. -
Christian Kuhn commented on patch set 7 CR -1 04/14/25, 12:25
ActionController.php:623use an inject* method to get a logger injected. no need to use the logManager at all. see other use cases within core. -
Lina Wolf commented on patch set 8 04/14/25, 12:25
Services.yaml:11ReplyDone -
Lina Wolf commented on patch set 8 04/14/25, 12:28
ActionController.php:623ReplyThat was what I tried intially. However it seems like injection the LoggerInterface via DI does not work in Extbase. In whole of Exbase I only found one usage of the Logger and there it was referenced in the exact way that I duplicated here. When you try to inject the logger, all tests are failing. -
core-ci voted on patch set 8 V +1 04/14/25, 12:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77699
-
Stefan Bürk commented on patch set 8 04/14/25, 20:51
ActionController.php:623ReplyTo note it for other reviewes: Lina tried already what lolli mentioned in changeset 4, which failed. The reason for this is, that LoggerInterface is not defined to be method injectable, the related compiler pass register this only for constructor injection. That means, we should have a look into that first (pre-patch) if that can be added first and then rework this change to get the logger injected using the inject method. @112@linawolf.de I set this change to WIP for now, hope that is okay for you. -
Stefan Bürk marked it work in progress 04/14/25, 20:51
-
Lina Wolf commented on patch set 8 04/18/25, 11:29
ActionController.php:623Reply@stefan@buerk.tech yes it is ok, is there a forge ticket about this already so that I can follow along?? -
Lina Wolf commented on patch set 8 04/25/25, 15:08
Waiting for https://forge.typo3.org/issues/106621 -
Stefan Bürk uploaded patch set 9
V +104/27/25, 12:52 -
Stefan Bürk commented on patch set 9 04/27/25, 12:55
ActionController.php:623ReplySee https://review.typo3.org/c/Packages/TYPO3.CMS/+/89244 which configures `LoggerInterface` for method injection along with a bunch of tests for it. I replaced the GU::makeInstance() for the logger with a method injection of the logger interface now for this change, basing it (relation chain) on the aforementioned changed making that change a blocker for this change, but it is prepared to reviewed and mergable afterwards.
-
Stefan Bürk updated the commit message in patch set 10 04/27/25, 12:56
-
core-ci voted on patch set 9 V +1 04/27/25, 13:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78228
-
core-ci voted on patch set 10 V +1 04/27/25, 13:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78230
-
Stefan Bürk rebased onto patch set 11
V +104/27/25, 15:14 -
core-ci voted on patch set 11 V +1 04/27/25, 15:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78240
-
Lina Wolf uploaded patch set 12
V +111/13/25, 13:11 -
Lina Wolf marked it ready for review 11/13/25, 13:12
-
Stefan Bürk commented on patch set 12 11/13/25, 13:14
ActionController.php:623ReplyIt seems that allowing logger injection based on inject method needs some time to discuss the concrete implementation, we should stay with the logger aware interface and trait tuple - to unblock this change for now. -
Lina Wolf commented on patch set 12 11/13/25, 13:15
ActionController.php:623ReplyAcknowledged -
Lina Wolf uploaded patch set 13 11/13/25, 13:17
-
core-ci voted on patch set 13 V +1 11/13/25, 13:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89500
-
core-ci voted on patch set 12 V -1 11/13/25, 13:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89499
-
core-ci voted on patch set 12 V -1 11/14/25, 04:05 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89499
-
Lina Wolf uploaded patch set 14
V +112/02/25, 15:56 -
core-ci voted on patch set 14 V +1 12/02/25, 16:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/91457
-
Simon Schaufelberger commented on patch set 14 12/03/25, 08:02
Feature-106462-ImproveFailedValidationErrorHandlingInExtbaseActionController.rst:1Move to 14.1 -
Lina Wolf uploaded patch set 15
V +112/03/25, 08:05 -
Lina Wolf commented on patch set 15 12/03/25, 08:05
Feature-106462-ImproveFailedValidationErrorHandlingInExtbaseActionController.rst:1ReplyDone -
core-ci voted on patch set 15 V +1 12/03/25, 08:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/91507
-
Torben Hansen commented on patch set 15 V -1 12/03/25, 09:04
This change is some kind of breaking, results in unexpected behavior and requires additional function implementation by most extension authors. In the current state of the patch, the `validationFailedAction` will always return the translated error message from `getValidationFailedFlashMessage()`. Users updating from previous TYPO3 versions and who suppress the flash messages via `getErrorFlashMessage()` returning `false` will now always see the flash message from `getValidationFailedFlashMessage()`. Additionally, if an extension provides a custom flash message in `getErrorFlashMessage()` this will now also not be shown any more, because the new `validationFailedAction()` basically takes over the validation error forwarding, so `errorAction()` will never be called. The validation error forward-handling in `validationFailedAction()` must therefore be removed, so the configured `errorMethodName` will be called again. I'm however really unsure about the change and the new default message generated by `getValidationFailedFlashMessage()`, because extension authors now must **overwrite two methods**, if they do not want any kind of validation/error flash messages generated by extbase action controller. I also think, that we already have the suggested functionality (=> `getErrorFlashMessage()`) in place, it currently just does not return a meaningful message. So basically, it would be a helpfull improvement to just improve the default message generated by `getErrorFlashMessage()` and to add logging in that function. -
Garvin Hicking commented on patch set 15 02/20/26, 09:10
Reply
That sounds logical to me to do the logging and improved output in the getErrorFlashMessage. Lina, would you be interested to move the patch forward before feature freeze? -
Garvin Hicking commented on patch set 15 02/20/26, 09:11
Ah sorry, now I see the cross-dependency to the logger injection to https://review.typo3.org/c/Packages/TYPO3.CMS/+/91984. -
Torben Hansen commented on patch set 15 02/20/26, 09:15
Reply Unresolved
As I wrote, we already have code in place and the change is breaking/non functional. I suggest to only improve the default message and to avoid introducing a new function here, which basically does the same as `getErrorFlashMessage()` -
Christian Kuhn wrote 06/18/26, 23:07
Removed reviewer Christian Kuhn. -
Lina Wolf abandoned the change 10/25/26, 17:38