Actions
Bug #88628
closedRedirect call on controller level is firing the action again
Status:
Rejected
Priority:
-- undefined --
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2019-06-25
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
Redirect
Complexity:
Is Regression:
Sprint Focus:
Description
I'm not really sure if this is a bug or something has changed here, but the behaviour in TYPO3 8 is not the same like in TYPO3 9.
It seems that a redirect call ($this->redirect()) on controller level will call the action again which have fired the redirect.
So if I do something like that:
class FormController extends ActionController
{
public function showAction(): void
{
// nothing to do just show the form
}
public function redirectAction(): void
{
$mailData = [
'sender' => $this->settings['senderEmail'],
'senderName' => $this->settings['senderName'],
'subject' => $this->settings['subject'],
'receivers' => explode(',', $this->settings['receiverEmails']),
'html' => '<h1>Redirect Test</h1>',
];
if (MailerUtility::send($mailData)) {
$this->redirect(
null,
null,
null,
null,
$this->settings['redirectPageId']
);
}
}
}
then the mail will be sent only once in TYPO3 8, but twice in TYPO3 9. Without the redirect call, the mail will be sent once in TYPO3 9, too. Maybe someone can tell me more about this behaviour?
Furthermore I have created a little example extension to reproduce this, which you can find in the attachment. The dependencies are set to TYPO3 9, but this example extension works in TYPO3 8, too.
- just install and enable the extension
- include the extension plugin and set some flexform data
- take a look at the frontend rendering of this plugin and submit the example form
Files
Actions