Project

General

Profile

Actions

Bug #106369

closed

redirectToUri has no effect anymore

Added by Sabrina Zwirner 2 days ago. Updated 1 day ago.

Status:
Closed
Priority:
Should have
Category:
Link Handling & Redirect Handling
Target version:
-
Start date:
2025-03-13
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
13
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

iScreen Shoter - Google Chrome - 250313150557.jpg (151 KB) iScreen Shoter - Google Chrome - 250313150557.jpg The RedirectResponse that get returned Sabrina Zwirner, 2025-03-13 14:06
Actions #1

Updated by Chris Müller 2 days ago

Strange, I used ->redirectToUri() today in an Extbase action with v13.4.7 (which worked).

Actions #2

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?

Actions #3

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();
    }
Actions #4

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.

Actions

Also available in: Atom PDF