Bug #87143

Side effects when using AbstractTypolinkBuilder in middlewares

Added by Benni Mack 9 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Frontend
Start date:
2018-12-13
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

When using TypolinkBuilder directly in a PSR-15 middleware, globals TSFE is always used, which leads to e.g. wrongly initialized current ID information. This can be solved by using proper DI.

Associated revisions

Revision 280bbccb (diff)
Added by Benni Mack 9 months ago

[BUGFIX] Do not depend on global TSFE for link generation

Handing in the dependency of TSFE into
AbstractLinkBuilder allows to use a custom TSFE
object, when working within middlewares (e.g. Redirects)
thus, not depending on global state directly.

As a drive-by-fix, using AbstractTypolinkBuilder now does not
generate a global TSFE anymore, which can have ugly side-effects.

Tests are now simplified because the original constructor can be
called directly instead of relying on $GLOBALS[TSFE].

Resolves: #87143
Releases: master, 9.5
Change-Id: I77f2da501d1a78f0579626ebb50ef47a0026f1f7
Reviewed-on: https://review.typo3.org/59036
Reviewed-by: Daniel Goerz <>
Tested-by: Daniel Goerz <>
Tested-by: TYPO3com <>
Reviewed-by: Andreas Wolf <>
Reviewed-by: Jörg Bösche <>
Reviewed-by: Wouter Wolters <>
Tested-by: Wouter Wolters <>

Revision 28b2dc20 (diff)
Added by Benni Mack 9 months ago

[BUGFIX] Do not depend on global TSFE for link generation

Handing in the dependency of TSFE into
AbstractLinkBuilder allows to use a custom TSFE
object, when working within middlewares (e.g. Redirects)
thus, not depending on global state directly.

As a drive-by-fix, using AbstractTypolinkBuilder now does not
generate a global TSFE anymore, which can have ugly side-effects.

Tests are now simplified because the original constructor can be
called directly instead of relying on $GLOBALS[TSFE].

Resolves: #87143
Releases: master, 9.5
Change-Id: I77f2da501d1a78f0579626ebb50ef47a0026f1f7
Reviewed-on: https://review.typo3.org/59181
Tested-by: TYPO3com <>
Reviewed-by: Wouter Wolters <>
Tested-by: Wouter Wolters <>

History

#1 Updated by Gerrit Code Review 9 months ago

  • Status changed from New to Under Review

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59036

#2 Updated by Gerrit Code Review 9 months ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59036

#3 Updated by Gerrit Code Review 9 months ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59036

#4 Updated by Gerrit Code Review 9 months ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59036

#5 Updated by Gerrit Code Review 9 months ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59181

#6 Updated by Benni Mack 9 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#7 Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF