From 38786329ef0da90957e1d3615fc5d78a5e9c1be3 Mon Sep 17 00:00:00 2001 From: Garvin Hicking <gh@faktor-e.de> Date: Thu, 26 Oct 2023 14:13:59 +0200 Subject: [PATCH] [BUGFIX] Reset UriBuilder for links generated by PasswordRecoveryService MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `EXT:felogin/Classes/Service/RecoveryService.php` makes use of the local $uriBuilder instance building links, however it does not `reset()` it's state before building a URL. It seems this only creates an issue when used in conjunction with `EXT:vhs` (possibly due to adapted fluid/object caching behavior?). Fixing this by resetting the instance as recommended via https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ExtensionArchitecture/Extbase/Reference/UriBuilder.html should take care of this, even though uriBuilder should be a singleton only operating within the scope of a single ActionController. Resolves: #102203 Releases: main, 12.4, 11.5 Change-Id: Idb6089c4b43b6d3352fbbbbeedfa63770959def0 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81589 Tested-by: core-ci <typo3@b13.com> Tested-by: Stefan Bürk <stefan@buerk.tech> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Stefan Bürk <stefan@buerk.tech> --- typo3/sysext/felogin/Classes/Service/RecoveryService.php | 4 +++- .../sysext/felogin/Tests/Unit/Service/RecoveryServiceTest.php | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/typo3/sysext/felogin/Classes/Service/RecoveryService.php b/typo3/sysext/felogin/Classes/Service/RecoveryService.php index a460d3d89905..2b19652e2c38 100644 --- a/typo3/sysext/felogin/Classes/Service/RecoveryService.php +++ b/typo3/sysext/felogin/Classes/Service/RecoveryService.php @@ -138,7 +138,9 @@ class RecoveryService implements RecoveryServiceInterface */ protected function prepareMail(Address $receiver, string $hash): Email { - $url = $this->uriBuilder->setCreateAbsoluteUri(true) + $url = $this->uriBuilder + ->reset() + ->setCreateAbsoluteUri(true) ->uriFor( 'showChangePassword', ['hash' => $hash], diff --git a/typo3/sysext/felogin/Tests/Unit/Service/RecoveryServiceTest.php b/typo3/sysext/felogin/Tests/Unit/Service/RecoveryServiceTest.php index 9e9d15ec1248..3e28641ba73f 100644 --- a/typo3/sysext/felogin/Tests/Unit/Service/RecoveryServiceTest.php +++ b/typo3/sysext/felogin/Tests/Unit/Service/RecoveryServiceTest.php @@ -94,6 +94,7 @@ class RecoveryServiceTest extends UnitTestCase $languageService->sL(Argument::containingString('password_recovery_mail_header'))->willReturn('translation'); $uriBuilder = $this->prophesize(UriBuilder::class); + $uriBuilder->reset()->willReturn($uriBuilder->reveal()); $uriBuilder->setCreateAbsoluteUri(true)->willReturn($uriBuilder->reveal()); $uriBuilder->uriFor( 'showChangePassword', -- GitLab