Review main Merged

93627[TASK] Deprecate GeneralUtility::getIndpEnv()

Christian Kuhn CR +2 V +2 Normal +130 −55 updated 04/12/26, 12:07

Commit message

Oh yeah. This took us some years. GU::getIndpEnv() was
one of those very old, very low level and very wide
spread methods in the framework.

It has been superseded by PSR-7 request and the attached
'normalizedParams' attribute a while ago already. The patch
finally deprecates GU:getIndpEnv().

* It uses a static cache property that is troublesome
  especially with sub requests.
* State should be passed, not injected or parked.
  getindpenv() is a side-channel to the most important
  framework state and is based on parked global state.
  Passed request should be used instead.
* Getting rid of last getIndpEnv() consumers surfaces
  remaining framework areas that rely on globals
  TYPO3_REQUEST.

A few GeneralUtility methods use getIndpEnv() as b/w
compat layer, and getIndpEnv() calls itself recursive.
To log deprecation notes only once per caller, the patch
introduces an internal "suppress deprecation" flag. It
will be removed together with the entire method in v15.
The internal helper setIndpEnv() will vanish in v15 as
well.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Garvin Hicking +1
    • Anja Leichsenring +1
    • Stefan Bürk +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Garvin Hicking +1
    • Anja Leichsenring +1
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 4

Files 6

Review log 1013

  1. Christian Kuhn uploaded patch set 1 04/11/26, 16:21

  2. core-ci voted on patch set 1 V +1 04/11/26, 16:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99973

  3. Christian Kuhn uploaded patch set 2 V +1 04/12/26, 08:00

  4. core-ci voted on patch set 2 V -1 04/12/26, 08:09 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100012

  5. core-ci voted on patch set 2 V +1 04/12/26, 08:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100012

  6. Garvin Hicking commented on patch set 2 04/12/26, 10:17

    Deprecation-109551-GeneralUtilityGetIndpEnv.rst:40

    How about "in cases where no PSR request is passed, and you absolutely cannot pass the request down your consumer's chain, you can for now use TYPO3_REQUEST global. This one's on the chopping block for the next version, though. So don't rely too hard on that and think about getting in on the request chain train."
  7. Anja Leichsenring voted on patch set 2 CR +1 V +1 04/12/26, 10:37

  8. Stefan Bürk voted on patch set 2 CR +1 V +1 04/12/26, 10:56

  9. Christian Kuhn commented on patch set 2 04/12/26, 10:59

    Deprecation-109551-GeneralUtilityGetIndpEnv.rst:40 Reply

    mmmh. i think most core API hands over request by now. the areas we work around in core are often rather internal and/or low level. i guess globals['typo3_request'] is well known, and i wouldn't want to hammer this even deeper into peoples minds since it will phase out slowly as well. i think it would be better when issues are raised where people still actively need request, don't get one, and request changes. this would help us to see where active actions for extensions need to be taken. as such, i prefer to abstain from documenting this option here, since it is non mid-term.
  10. Christian Kuhn commented on patch set 2 04/12/26, 11:00

    Deprecation-109551-GeneralUtilityGetIndpEnv.rst:40 Reply

    i don't insist on this view, though. if such a hint is important to you, feel free to adapt the change.
  11. Garvin Hicking commented on patch set 2 CR +1 V +1 04/12/26, 11:54

    Deprecation-109551-GeneralUtilityGetIndpEnv.rst:40 Reply

    With your argument I'm fine. Let's see if we can nudge people this way.
  12. Christian Kuhn voted on patch set 2 CR +2 V +2 04/12/26, 12:06

  13. Christian Kuhn merged patch set 3 04/12/26, 12:07