Bug #106369
closedredirectToUri has no effect anymore
100%
Description
Hello,
I recently updated to TYPO3 version 13.4.7.
I have an extension that handles a custom form request, sends an email and should then redirect to a small "Thank You" page.
Everything is working but unfortunately, the code I used before to redirect no longer works since the update.
I’m not receiving any errors—instead, the page simply reloads, but the section where the plugin was included appears empty.
I have added a picture of the returned RedirectResponse.
protected function sendAppointmentRequest($args): ResponseInterface
{
$recipient = $args['email'];
$answer = $this->settings['answeremail'];
$answerName = $this->settings['answername'];
$bccEmail = $this->settings['bccemail'];
$bccName = $this->settings['bccname'];
$subject = $this->settings['subject'];
$templateName = 'Appointment';
$redirectPage = $this->settings['redirectPage'];
$variables = [
'args' => $args,
'answeremail' => $answer,
'answername' => $answerName,
];
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($variables);die;
if (null !== $recipient && !empty($args)) {
$this->sendTemplateEmail($recipient, $answer, $answerName, $bccEmail, $bccName, $subject, $templateName, $variables);
}
$uri = $this->uriBuilder->reset()->setTargetPageUid((int)$redirectPage)->build();
return $this->redirectToUri($uri);
}
Files
Updated by Chris Müller 2 days ago
Strange, I used ->redirectToUri() today in an Extbase action with v13.4.7 (which worked).
Updated by Garvin Hicking 2 days ago
- Status changed from New to Needs Feedback
Could another middleware be involved? Or some internal additional redirect? How is the extbase action defined (cached/uncached)?
Maybe you can create a minimal extension to try to reproduce this in a vanilla installation without other extensions?
Updated by Sabrina Zwirner 1 day ago
- Assignee set to Sabrina Zwirner
- % Done changed from 0 to 100
This can be closed....
I should have drank one coffee more.
The function is used in the requestAction...
There inside was a return statement missing. So it was always showing the empty Request.html.
Old code is a blast to work with :D
public function requestAction(ContactForm $contactForm): ResponseInterface
{
$args = $this->request->getArguments();
if ([] !== $args) {
$this->sendAppointmentRequest($args['contactForm']);
} else {
return $this->redirectToPage((int) $this->settings['redirectFailurePage']);
}
return $this->htmlResponse();
}
Updated by Garvin Hicking 1 day ago
- Status changed from Needs Feedback to Closed
Thanks for getting back and you solving the riddle. :) Closing as requested.