Review main Merged

67255[TASK] Replace GeneralUtility::getIndpEnv('REQUEST_URI')

Anja Leichsenring CR +2 V +2 Normal +151 −70 updated 01/07/21, 17:13

Commit message

If a reqest object already is around,
$request->getAttribute('normalizedParams')->getRequestUri()
can be used as a drop in replacement.
As a fallback $GLOBALS['TYPO3_REQUEST'] is almost always
available and contains the request object.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Oli Bartsch +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Oli Bartsch +1
    • TYPO3com +1 CI

Issues 1

Files 39

Show 19 more files

Review log 3352

Show 1827 earlier messages
  1. Anja Leichsenring uploaded patch set 1 12/28/20, 17:06

  2. TYPO3com voted on patch set 1 V -1 12/28/20, 17:06 Completed build in 32s on Mon, 28 Dec, 05:06 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8474

  3. Anja Leichsenring uploaded patch set 2 12/28/20, 17:11

  4. TYPO3com voted on patch set 2 V -1 12/28/20, 17:24 Completed build in 11m 58s on Mon, 28 Dec, 05:24 PM Test Summary: 60 of 32781 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8475

  5. Anja Leichsenring uploaded patch set 3 12/28/20, 17:49

  6. TYPO3com voted on patch set 3 V -1 12/28/20, 17:50 Completed build in 27s on Mon, 28 Dec, 05:50 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8477

  7. Anja Leichsenring uploaded patch set 4 12/28/20, 17:51

  8. TYPO3com voted on patch set 4 V +1 12/28/20, 18:01 Completed build in 10m 13s on Mon, 28 Dec, 06:01 PM Test Summary: 32540 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8478

  9. Benjamin Franzke uploaded patch set 5 12/28/20, 19:42

  10. Benjamin Franzke commented on patch set 5 12/28/20, 19:42

    Hm, I'm unsure about this one, please see why: https://review.typo3.org/c/Packages/TYPO3.CMS/+/55506/22//COMMIT_MSG#14 > For a transition phase, the request is made available > as $GLOBALS['TYPO3_REQUEST'] until enough core code has > been refactored to get rid of this again. The idea really was that $GLOBALS['TYPO3_REQUEST'] is to be used as hack, not as the new go-to solution, the intention is to refactor code to provide PSR-7 requests where (really) needed, like recently in: https://review.typo3.org/c/Packages/TYPO3.CMS/+/66080 This patch is good, where it used locally available PSR-7 request objects, but changing everything to $GLOBALS['TYPO3_REQUEST'] doesn't improve the code, as it hides the next implicit dependency, as we would not checked that $GLOBALS['TYPO3_REQUEST'] is actually set, and phpstan will hate use for that at some point. ;) I would rather love to include only those changes, where a non-global PSR-7 request is available, and instead seek for more adaptions, where either a PSR-7 request is required (or where REQUEST_URI may just not be needed, e.g. because the router/uri-builder should be used instead)

    AbstractPlugin.php:911

    Let's avoid GLOBALS and use $this->cObj->getRequest() which was recently introduced in https://review.typo3.org/c/Packages/TYPO3.CMS/+/66080
  11. TYPO3com voted on patch set 5 V +1 12/28/20, 19:52 Completed build in 09m 56s on Mon, 28 Dec, 07:52 PM Test Summary: 32540 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8480

  12. Alexander Schnitzler commented on patch set 5 12/30/20, 11:50

    Reply

    Full ack, if you hadn't written this, I would have. Everything is well explained, nothing to add. Just want to emphasize how important this is. Let's put our energy into PSR-7 and passing the request or request values along.
  13. Anja Leichsenring uploaded patch set 6 01/04/21, 18:40

  14. TYPO3com voted on patch set 6 V -1 01/04/21, 18:50 Completed build in 10m 11s on Mon, 4 Jan, 06:50 PM Test Summary: 6 of 32784 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8607

  15. Anja Leichsenring uploaded patch set 7 01/04/21, 19:06

  16. TYPO3com voted on patch set 7 V +1 01/04/21, 19:16 Completed build in 10m 12s on Mon, 4 Jan, 07:16 PM Test Summary: 32545 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8609

  17. Christian Kuhn commented on patch set 6 01/04/21, 19:17

    Reply

    Hey. I totally agree with you two. It's only that my progress strategy is different. tl;dr: Get the getIndpEnv() patches in, use $request when available or possible, but fallback to globals TYPO3_REQUEST if there is no good solution to reach $request *for now*. Reasoning: This patch is about getting rid of getIndpEnv() - That method hides dependencies to _server, to $request to Environment and more. I currently rate the benefits of getting rid of getIndpEnv() higher than using globals TYPO3_REQUEST at some more places. When core usages of getIndpEnv() are gone, we basically just need to grep for TYPO3_REQUEST to see all code smell - mostly the combined results of the TYPO3_MODE removal and getindpEnv() removals, and some others. We can then refactor those places since we can analyze the full nightmare per single place, which can help us to find the best solutions per construct. Thus, my strategy would is: Use $request where ever possible with this and other upcoming "get rid of getIndpEnv()" patches. For simple cases (like "use cObcj->getRequest()"), we should do it. Places that are harder to reach (like low-level FAL API stuff, or other low-level classes), we should fallback to globals TYPO3_REQUEST *for now*, and adapt these changes in further refactoring rounds. So yes, this will lead to more TYPO3_REQUEST usages, but we get rid of getIndpEnv() already and can tackle the harder globals usages one-by-one afterwards. And yes, this will not be forgotten.

    AbstractPlugin.php:911 Reply

    +
  18. Christian Kuhn commented on patch set 7 01/04/21, 19:19

    Reply

    Is this strategy an acceptable solution for you two? If so, we'd have a look at this patch again to see where $request could be easily hand over and use it, and keep TYPO3_REQUEST usages at places where it's not easy to avoid ... for now.
  19. Anja Leichsenring commented on patch set 7 01/04/21, 19:44

    AbstractPlugin.php:911 Reply Unresolved

    thanks for the fix, Ben. I was not aware that cObj carries the request, so thanks for that lesson, too.
  20. Benni Mack commented on patch set 7 01/05/21, 12:06

    Reply

    Yeah, I feel the same way - using getIndpEnv() is the same as using $_SERVER[REQUEST_URI] right now, effectively not allowing us to use proper subrequests in general (for example). In the short-term it's "replacing one global with another" but we clearly need to come up with more ways to inject the request object, especially in the controllers and the VHs, then this patch would be much smoother to read.
  21. Anja Leichsenring uploaded patch set 8 01/05/21, 16:39

  22. Anja Leichsenring commented on patch set 8 01/05/21, 16:40

    I try to improve the usage of injected / handed over request
  23. TYPO3com voted on patch set 8 V +1 01/05/21, 16:52 Completed build in 10m 35s on Tue, 5 Jan, 04:52 PM Test Summary: 32545 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8635

  24. Anja Leichsenring uploaded patch set 9 01/05/21, 16:53

  25. Alexander Schnitzler commented on patch set 9 01/05/21, 16:56

    Reply Unresolved

    > Is this strategy an acceptable solution for you two? Sure, hence no -1. As long as we have the same goal. 😊
  26. TYPO3com voted on patch set 9 V +1 01/05/21, 17:03 Completed build in 09m 35s on Tue, 5 Jan, 05:03 PM Test Summary: 32545 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8636

  27. Anja Leichsenring uploaded patch set 10 01/05/21, 17:43

  1. TYPO3com voted on patch set 10 V +1 01/05/21, 17:54 Completed build in 10m 13s on Tue, 5 Jan, 05:54 PM Test Summary: 32545 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8639

  2. Anja Leichsenring uploaded patch set 11 01/05/21, 17:58

  3. Anja Leichsenring uploaded patch set 12 01/05/21, 18:07

  4. TYPO3com voted on patch set 11 V -1 01/05/21, 18:08 Completed build in 09m 46s on Tue, 5 Jan, 06:08 PM Test Summary: 1 of 32786 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8641

  5. Anja Leichsenring uploaded patch set 13 01/05/21, 18:14

  6. TYPO3com voted on patch set 12 V +1 01/05/21, 18:16 Completed build in 09m 45s on Tue, 5 Jan, 06:16 PM Test Summary: 32545 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8642

  7. TYPO3com voted on patch set 13 V -1 01/05/21, 18:23 Completed build in 09m 08s on Tue, 5 Jan, 06:23 PM Test Summary: 1 of 32786 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8643

  8. Anja Leichsenring uploaded patch set 14 01/05/21, 18:42

  9. Anja Leichsenring uploaded patch set 15 01/05/21, 18:46

  10. Anja Leichsenring updated the commit message in patch set 16 01/05/21, 18:49

  11. TYPO3com voted on patch set 14 V -1 01/05/21, 18:57 Completed build in 14m 42s on Tue, 5 Jan, 06:57 PM Test Summary: 1 of 32786 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8645

  12. TYPO3com voted on patch set 15 V -1 01/05/21, 19:01 Completed build in 10m 54s on Tue, 5 Jan, 07:01 PM Test Summary: 1 of 32786 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8646

  13. TYPO3com voted on patch set 16 V +1 01/05/21, 19:06 Completed build in 16m 02s on Tue, 5 Jan, 07:06 PM Test Summary: 32545 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8647

  14. Anja Leichsenring commented on patch set 16 01/05/21, 19:11

    I don't think the readability of the patch improved, but as far as I can see now the only places without proper request object are now in fluid context, where only an extbase request object is available. So please review again.
  15. Christian Kuhn uploaded patch set 17 01/06/21, 14:17

  16. Christian Kuhn commented on patch set 17 01/06/21, 14:17

    rebased
  17. TYPO3com voted on patch set 17 V -1 01/06/21, 14:28 Completed build in 10m 58s on Wed, 6 Jan, 02:28 PM Test Summary: 1 of 32806 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8684

  18. TYPO3com voted on patch set 17 V +1 01/06/21, 14:35 Completed build in 29m 22s on Wed, 6 Jan, 02:35 PM Test Summary: 32565 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8684

  19. Christian Kuhn voted on patch set 17 V +1 CR +1 01/06/21, 14:52

  20. Christian Kuhn commented on patch set 17 V 0 CR -1 01/07/21, 16:53

    oli will push a detail
  21. Oli Bartsch uploaded patch set 18 01/07/21, 16:54

  22. Oli Bartsch voted on patch set 18 V +1 CR +1 01/07/21, 16:57

  23. TYPO3com voted on patch set 18 V +1 01/07/21, 17:04 Completed build in 09m 36s on Thu, 7 Jan, 05:04 PM Test Summary: 32565 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8744

  24. Christian Kuhn voted on patch set 18 V +2 CR +2 01/07/21, 17:13

  25. Christian Kuhn merged patch set 19 01/07/21, 17:13