71600[BUGFIX] Check for TSFE before use in ContentObjectRenderer
Commit message
Review
-
Code review CR +2 Done
- Benjamin Franzke +2
- Christian Kuhn +1
-
Verified V +2 Done
- Benjamin Franzke +2
- Christian Kuhn +1
- core-ci +1 CI
Issues 1
Files 1
Review log 811
-
Stefan Bürk uploaded patch set 1 10/12/21, 19:02
-
core-ci voted on patch set 1 V +1 10/12/21, 19:16 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/17991
-
Josef Glatz commented on patch set 1 CR -1 10/13/21, 02:23
should it be ‚uninitialized‘? or ‚not initialized‘? -
Stefan Bürk updated the commit message in patch set 2 10/13/21, 07:33
-
Stefan Bürk commented on patch set 2 10/13/21, 07:34
Reply
Thx. Done. -
core-ci voted on patch set 2 V -1 10/13/21, 07:55 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18012
-
core-ci voted on patch set 2 V +1 10/13/21, 08:22 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18012
-
Christian Kuhn commented on patch set 2 V +1 CR +1 10/13/21, 09:48
stefan and me discussed this case and think that it's good to loosen the dependency to tsfe in typolink() instead of changing test mocking in this case. -
Benjamin Franzke commented on patch set 2 V +2 CR +2 10/13/21, 11:36
Reply
Hm.. Note that I'm unsure in general to support these usecases in ContentObjectRenderer. Out of interest: Do you see a realworld usecase for using `typolink()` without a TypoScriptFrontendController instance? I mean, ContentObjectRenderer is intended for TypoScript rendering, not as generic link API. It that supported at all or does it only work by accident and mostly do help with tests that aren't properly mocked? Anyway, I just tested the following code in an early middleware, without TSFE available and it works in php 7.4, so yea, we probably need to make sure it works in php 8 as well. $cObj = new \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer(null, null); $cObj->setRequest($request); echo $cObj->typoLink('Testlink', ['parameter' => 1]); So yes, it's usable, but I hope we limit that in v12 to require TSFE to be set. Or at least deprecate ContentObjectRenderer with $tsfe=null. I think it would be useful anyway for tests to add proper TSFE mocks – since that's the realword usecase. Still, this patch fixes a possible realworld problem in case ContentObjectRenderer->typoLink is (mis)used as generic linking API, therefore I'm going to merge. -
Benjamin Franzke merged patch set 3 10/13/21, 11:36
-
Christian Kuhn commented on patch set 2 V +1 CR +1 10/13/21, 11:39
Reply
Yes and no, Benjamin ... I think mid-term, we'll relax the dependency to TSFE in typolink() - with this attitude in mind, this patch has been created and didn't change the tests. I wasn't 100% sure, but think it is the right direction in this case.