From 92d1d32dad925784fbdda95ead34cb96c523946b Mon Sep 17 00:00:00 2001 From: Christoph Lehmann <christoph.lehmann@networkteam.com> Date: Tue, 12 Mar 2024 10:20:06 +0100 Subject: [PATCH] [BUGFIX] Add server request to view in ConfirmationFinisher MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since #98377 it is not possible to use `f:link.page` ViewHelper in the ConfirmationFinisher template. This adds the server request to the standalone view to make it work again. Also removed wrong comment and direct usage of global request object. Resolves: #103368 Releases: main, 12.4 Change-Id: I3822cda0bb5fde9feb992696775051ec676592c8 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83433 Reviewed-by: Stefan Bürk <stefan@buerk.tech> Tested-by: Stefan Bürk <stefan@buerk.tech> Tested-by: Oliver Bartsch <bo@cedev.de> Tested-by: core-ci <typo3@b13.com> Reviewed-by: Oliver Bartsch <bo@cedev.de> --- typo3/sysext/fluid/Classes/View/StandaloneView.php | 2 +- .../form/Classes/Domain/Finishers/ConfirmationFinisher.php | 1 + .../sysext/form/Classes/Domain/Finishers/EmailFinisher.php | 7 +------ 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/typo3/sysext/fluid/Classes/View/StandaloneView.php b/typo3/sysext/fluid/Classes/View/StandaloneView.php index f76f0c6f4e08..18029fc313b0 100644 --- a/typo3/sysext/fluid/Classes/View/StandaloneView.php +++ b/typo3/sysext/fluid/Classes/View/StandaloneView.php @@ -47,7 +47,7 @@ class StandaloneView extends AbstractTemplateView } /** - * @internal Currently used especially in functional tests. May change. + * @internal */ public function setRequest(?ServerRequestInterface $request = null): void { diff --git a/typo3/sysext/form/Classes/Domain/Finishers/ConfirmationFinisher.php b/typo3/sysext/form/Classes/Domain/Finishers/ConfirmationFinisher.php index 9092fb5f36b2..dc5f40f6f4c3 100644 --- a/typo3/sysext/form/Classes/Domain/Finishers/ConfirmationFinisher.php +++ b/typo3/sysext/form/Classes/Domain/Finishers/ConfirmationFinisher.php @@ -126,6 +126,7 @@ class ConfirmationFinisher extends AbstractFinisher protected function initializeStandaloneView(FormRuntime $formRuntime): StandaloneView { $standaloneView = GeneralUtility::makeInstance(StandaloneView::class); + $standaloneView->setRequest($this->finisherContext->getRequest()); if (!isset($this->options['templateName'])) { throw new FinisherException( diff --git a/typo3/sysext/form/Classes/Domain/Finishers/EmailFinisher.php b/typo3/sysext/form/Classes/Domain/Finishers/EmailFinisher.php index 395e6a84f600..f81d9ccb1c25 100644 --- a/typo3/sysext/form/Classes/Domain/Finishers/EmailFinisher.php +++ b/typo3/sysext/form/Classes/Domain/Finishers/EmailFinisher.php @@ -17,7 +17,6 @@ declare(strict_types=1); namespace TYPO3\CMS\Form\Domain\Finishers; -use Psr\Http\Message\ServerRequestInterface; use Symfony\Component\Mime\Address; use TYPO3\CMS\Core\Mail\FluidEmail; use TYPO3\CMS\Core\Mail\MailerInterface; @@ -203,12 +202,8 @@ class EmailFinisher extends AbstractFinisher $this->options['templateName'] = 'Default'; } - // Set the PSR-7 request object if available - if (($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface) { - $fluidEmail->setRequest($GLOBALS['TYPO3_REQUEST']); - } - $fluidEmail + ->setRequest($this->finisherContext->getRequest()) ->setTemplate($this->options['templateName']) ->assignMultiple([ 'finisherVariableProvider' => $this->finisherContext->getFinisherVariableProvider(), -- GitLab