94931[TASK] Avoid frontend context leak in extbase controller tests
Commit message
Review
-
Code review CR +2 Done
- Benni Mack +2
- Garvin Hicking +1
- Stefan Bürk +1
-
Verified V +2 Done
- Benni Mack +2
- Garvin Hicking +1
- Stefan Bürk +1
- core-ci +1 CI
Issues 4
Files 1
Review log 1520
-
Benni Mack uploaded patch set 1 07/24/26, 15:19
-
core-ci voted on patch set 1 V -1 07/24/26, 15:31 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105339
-
core-ci commented on patch set 1 07/24/26, 16:28 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105339
-
Benni Mack marked it work in progress 07/24/26, 16:34
-
Rémy DANIEL commented on patch set 1 07/24/26, 16:35
Hi. I think the issue marked as resolved is not the right one. -
Benni Mack updated the commit message in patch set 2
V -107/24/26, 16:41 -
Benni Mack commented on patch set 2 07/24/26, 16:41
Reply
yes. thank you -
core-ci voted on patch set 2 V -1 07/24/26, 16:51 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105347
-
Benni Mack uploaded patch set 3
V -107/24/26, 18:59 -
Benni Mack marked it ready for review 07/24/26, 19:08
-
core-ci voted on patch set 3 V +1 07/24/26, 19:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105349
-
Garvin Hicking commented on patch set 3 CR +1 V +1 07/25/26, 11:42
Wow what a mess 🤪 -
Oliver Klee voted on patch set 3 V +1 07/25/26, 12:08
-
Oliver Klee commented on patch set 3 07/25/26, 12:09
BlogPostEditingControllerTest.php:134I think we can use `$this->get(Context::class)` instead in both places. -
Stefan Bürk rebased onto patch set 4
CR +1V +107/25/26, 17:33 -
core-ci voted on patch set 4 V +1 07/25/26, 17:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105396
-
Stefan Bürk commented on patch set 4 CR +1 V +1 07/25/26, 18:01
BlogPostEditingControllerTest.php:134ReplyAgreed in principle, but it does not hold yet on this patch - it only works once the container is restored, so I adopted it one change up instead, in the WIP change https://review.typo3.org/c/Packages/TYPO3.CMS/+/94945 The two are not equivalent while the leak is still there. After executeFrontendSubRequest(), the globally registered container is still the one Bootstrap::init() built for the frontend request. GeneralUtility::makeInstance() therefore resolves Context through that leaked frontend container - which is exactly the instance Extbase's Typo3QuerySettings reads afterwards. $this->get() resolves through FunctionalTestCase::$container, the container of the test scope, and hands out a different Context instance. Setting the aspect there would leave the object that consumers actually read untouched, and the workaround would silently stop working. Verified locally on sqlite: * this patch as is, testing-framework dev-main: OK (10 tests, 59 assertions) * this patch with $this->get() in both places, dev-main: 1 failure, the category assertion in fullyLocalizedFormSubmissionPersistsDataOfSelectedBlogForRequestedTranslation * this patch with $this->get(), on top of testing-framework branch frontendrequest-context-leak: OK The testing-framework branch restores Context and the DI container in FrameworkState::push()/pop(), after which both resolve to the same service - every SingletonInterface implementation is a public service via SingletonPass - and your suggestion is the better spelling. 94945 requires that branch, drops the workaround introduced here and switches the remaining call to $this->get(Context::class). So I would keep makeInstance() here as long as this change targets dev-main and https://github.com/TYPO3/testing-framework/pull/734 has not been merged and raised for `main` - I'll added the suggested change into the gerrit change testing the testing-framework change and already removing the workaround introduced in this change again. See: 94945: [WIP][TASK] Test testing-framework context leak fix | https://review.typo3.org/c/Packages/TYPO3.CMS/+/94945 -
Garvin Hicking voted on patch set 4 CR +1 V +1 07/25/26, 20:01
-
Benni Mack commented on patch set 4 CR +2 V +2 07/26/26, 15:10
BlogPostEditingControllerTest.php:134Replyyeah, that's the main reason for using makeInstance here (= and documenting this with the commit). -
Benni Mack merged patch set 5 07/26/26, 15:10