Review main Merged

92615[BUGFIX] Order template, partial and layout paths correctly in Extbase context

Dmitry Dulepov CR +2 V +2 Normal +68 −37 updated 02/03/26, 09:20

Commit message

The change checks if the default path to the template, partial or layout
directory of the current extension already exists in the plugin
configuration and does not prepend it if it is set explicitly.

Review

  • Code review CR +2 Done
    • Simon Praetorius +2
    • Garvin Hicking +1
  • Verified V +2 Done
    • Simon Praetorius +2
    • Garvin Hicking +1
    • core-ci +1 CI

Issues 1

Files 4

Review log 4050

Show 1925 earlier messages
  1. Dmitry Dulepov uploaded patch set 1 02/01/26, 11:58

  2. Dmitry Dulepov commented on patch set 1 02/01/26, 12:01

    I tried to add tests for this change but there is no existing one and I could not find how to do it. Basically we need to test that this order will be kept: 10 = EXT:anotherext1/Resources/Private/Partials/ 20 = EXT:anotherext2/Resources/Private/Partials/ 100 = EXT:myext/Resources/Private/Partials/ Where "myext" is the extension of the current plugin. Keys do not matter, the order does.
  3. Dmitry Dulepov uploaded patch set 2 02/01/26, 12:05

  4. core-ci voted on patch set 1 V -1 02/01/26, 12:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94759

  5. core-ci voted on patch set 2 V -1 02/01/26, 12:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94760

  6. Dmitry Dulepov uploaded patch set 3 V -1 02/01/26, 12:55

  7. Garvin Hicking commented on patch set 2 02/01/26, 13:08

    Reply

    Hey thanks for getting to it. If you check out the CI teat results, these already report issues where due to ordering the expectations are now different. I believe the introduced Helper method currently does no array key Sorting?
  8. Dmitry Dulepov commented on patch set 3 02/01/26, 13:20

    Reply

    It does not need to sort because sorting happens deeper in TemplatePaths class. I believe failures happen when there are several paths to the same extension. For example, when the configuration is like this: 10 = EXT:anotherext1/Resources/Private/Partials/ 20 = EXT:anotherext1/Resources/Private/Partials/ 30 = EXT:myext/Resources/Private/PartialsOverride/ 40 = EXT:myext/Resources/Private/Partials/Override/ Before the patch finals paths were: 1 = EXT:myext/Resources/Private/Partials/ 2 = EXT:anotherext1/Resources/Private/Partials/ 3 = EXT:anotherext1/Resources/Private/Partials/ 4 = EXT:myext/Resources/Private/PartialsOverride/ 5 = EXT:myext/Resources/Private/Partials/Override/ Now they are: 1 = EXT:anotherext1/Resources/Private/Partials/ 2 = EXT:anotherext1/Resources/Private/Partials/ 3 = EXT:myext/Resources/Private/PartialsOverride/ 4 = EXT:myext/Resources/Private/Partials/Override/ 5 = EXT:myext/Resources/Private/Partials/ So what is needed here is to insert the default path before any other path to the current extension, like this: 1 = EXT:anotherext1/Resources/Private/Partials/ 2 = EXT:anotherext1/Resources/Private/Partials/ 3 = EXT:myext/Resources/Private/Partials/ 4 = EXT:myext/Resources/Private/PartialsOverride/ 5 = EXT:myext/Resources/Private/Partials/Override/ or to keep previous behaviour if there are paths to the current extension in the array. I am thinking on it.
  9. core-ci voted on patch set 3 V -1 02/01/26, 13:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94761

  10. Dmitry Dulepov commented on patch set 3 02/01/26, 17:48

    Reply

    Oh, I see what you mean by sorting :)
  11. Simon Praetorius commented on patch set 3 V -1 02/01/26, 18:35

    From my point of view, there are two bugs in this area: One in Extbase and one in Fluid Standalone. Extbase might be fixable for v13 and v14, Fluid will likely be v14 only. I've created a pre-patch (https://review.typo3.org/c/Packages/TYPO3.CMS/+/92619) which adds test cases for both issues. After the pre-patch is merged, the goal of this patch should be to fix the `@todo` in `extbaseSpecificOverrideScenariosDataProvider()`, all other tests should stay green. The current state of this patch does not accomplish that. For Fluid, I've already created a patch that should fix the other three `@todo` (https://github.com/TYPO3/Fluid/pull/1298).
  12. Dmitry Dulepov commented on patch set 3 02/01/26, 18:41

    Reply

    The change I am making will fix the issue described in the ticket. Paths will work correctly for both v13 and v14. This is what needed right now in existing customers' projects. Of course, you can fix this is fluid too but v13 needs to be fixed as well.
  13. Simon Praetorius commented on patch set 3 02/01/26, 20:08

    Reply

    The failing tests suggest that the current version of this patch breaks existing functionality.
  14. Dmitry Dulepov commented on patch set 3 02/01/26, 21:13

    Reply

    Working on it and adding more tests.
  15. Dmitry Dulepov uploaded patch set 4 V -1 02/01/26, 21:32

  16. core-ci voted on patch set 4 V +1 02/01/26, 22:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94783

  17. Garvin Hicking commented on patch set 4 02/02/26, 02:29

    Reply

    Can you rebase this patch, there are merge conflicts due to changes in the tests merged meanwhile?
  18. Dmitry Dulepov uploaded patch set 5 V +1 02/02/26, 08:16

  19. Dmitry Dulepov commented on patch set 5 02/02/26, 08:16

    Reply

    Acknowledged
  20. core-ci voted on patch set 5 V -1 02/02/26, 08:29 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94798

  21. Dmitry Dulepov uploaded patch set 6 V -1 02/02/26, 10:00

  22. Dmitry Dulepov commented on patch set 6 02/02/26, 10:01

    Strange: locally all tests pass but they fail in CI jobs.
  23. core-ci voted on patch set 6 V -1 02/02/26, 10:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94806

  24. Simon Praetorius commented on patch set 6 02/02/26, 11:02

    TemplatesPathsTest.php:121

    I don't think that these can be fixed purely with changes in Extbase, as the tests will also be executed for FLUIDTEMPLATE. This is the part that is covered by the Fluid patch. If your fix addresses this for Extbase, I'd suggest to comment the affected datasets and to duplicate them (for now) to the second data provider, which will only be used for Extbase.
  25. Dmitry Dulepov uploaded patch set 7 V -1 02/02/26, 13:41

  1. Dmitry Dulepov commented on patch set 7 02/02/26, 13:46

    TemplatesPathsTest.php:121 Reply

    @simon@praetorius.me This is already a part of the patch. I also changed logic from adding to the end to prepending only if it is not set explicitly because this would be the most compatible way.
  2. Simon Praetorius commented on patch set 7 02/02/26, 14:07

    TemplatesPathsTest.php:121 Reply

    I currently don't understand what and why you are moving around in the tests. The more you change the tests and the implementation at the same time, the more it becomes necessary to split out the tests into a pre-patch to make clear what actually changes. That was the reasoning behind my pre-patch, which you now (partly) reverted.
  3. core-ci voted on patch set 7 V +1 02/02/26, 14:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94819

  4. Dmitry Dulepov commented on patch set 7 02/02/26, 14:33

    TemplatesPathsTest.php:121 Reply

    It could be better if you let me finish the work first before making your changes and adding those todos. I had to partially rework your change because my patch has changed and it needed different tests. Those todos were not valid anymore. Also "defaultOverride" change had incorrect first array member in it and did not work. New tests test two things: 1) when there is no path given, the default path shoild work (there were no such test at all), 2) when there is a default path in the configuration at the highest number, it should be used. The first test covers the missing "before the patch" change and the second test covers the patch. While working on the patch and testing I found that the patch should not append the path to the end as I thought initially because it breaks compatibility. The path should be prepended to the configuration only if it is not already there. This makes it compatible with existing behavior while ensuring that the default path can still override paths with lower numbers. I also updated the description to match the logic.
  5. Simon Praetorius commented on patch set 7 02/02/26, 15:17

    TemplatesPathsTest.php:121 Reply

    > Those todos were not valid anymore. They are for `FLUIDTEMPLATE`. So I would prefer it if those cases would still be present with `@todo`, since they still need fixing. Maybe we can add another data provider just for `FLUIDTEMPLATE`, until the Fluid change is merged and everything behaves the same again?

    TemplatesPathsTest.php:155

    Isn't that already covered by `baseRenderingWorksForControllerAsPluginUsageWithoutConfig()`?
  6. Simon Praetorius commented on patch set 7 02/02/26, 15:20

    TemplatesPathsTest.php:121 Reply

    (also, I think the currently removed cases test for a different use case, where the ExtBase defaults aren't involved at all. That's why they could be shared both for Extbase and `FLUIDTEMPLATE`. I think it's worth keeping those.)
  7. Dmitry Dulepov commented on patch set 7 02/02/26, 15:27

    TemplatesPathsTest.php:121 Reply

    The fix for fluid is not a part of this patch. So changes for that fix should be separate. Why don't you make a new ticket describing the issuem linking to the PR you made for fluid and adding tests with that ticket number?

    TemplatesPathsTest.php:155 Reply

    Probably but the new test does it with all those "pluginConfig" modes, which "baseRenderingWorksForControllerAsPluginUsageWithoutConfig" does not use.
  8. Simon Praetorius commented on patch set 7 02/02/26, 15:33

    TemplatesPathsTest.php:121 Reply

    I'm not asking you to add the fix to your patch. But it's important to document existing behavior in tests to see the consequences of a bugfix later on. So please don't remove relevant test cases in your patch.

    TemplatesPathsTest.php:155 Reply

    Ok, then let's remove the test that I added and give the new test a better name, something like `onlyDefaultPaths`.
  9. Dmitry Dulepov commented on patch set 7 02/02/26, 15:51

    TemplatesPathsTest.php:121 Reply

    I believe that the change should contain only tests that are related to the patch. Why don't you submit your own separate change with more tests for resolving paths? This would be very good and useful I think. You can even name it accordingly: "Add more tests for resolving paths to layouts, partials and templates" or so. I believe in grouping related changes, it makes easier to analyze changes in future.

    TemplatesPathsTest.php:155 Reply

    What test do you mean? I think "defaultReordered" is a good and relevant test for this patch.
  10. Simon Praetorius commented on patch set 7 02/02/26, 15:58

    TemplatesPathsTest.php:121 Reply

    > Why don't you submit your own separate change with more tests for resolving paths? That's exactly what I did, and it went in before your changes. So now you can't just remove test cases and todos that are still relevant.

    TemplatesPathsTest.php:155 Reply

    remove `baseRenderingWorksForControllerAsPluginUsageWithoutConfig()` and rename your `haveDefaultPath`.
  11. Dmitry Dulepov commented on patch set 7 02/02/26, 16:42

    TemplatesPathsTest.php:121 Reply

    I see. Let me run all tests (including yours again) and see if they still work.
  12. Dmitry Dulepov uploaded patch set 8 V +1 02/02/26, 16:56

  13. Dmitry Dulepov commented on patch set 8 02/02/26, 16:57

    TemplatesPathsTest.php:121 Reply

    I restored them.
  14. core-ci voted on patch set 8 V +1 02/02/26, 17:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94830

  15. Simon Praetorius uploaded patch set 9 V +1 02/02/26, 18:45

  16. Simon Praetorius commented on patch set 9 CR +1 V +1 02/02/26, 18:46

    TemplatesPathsTest.php:155 Reply

    Done
  17. core-ci voted on patch set 9 V +1 02/02/26, 18:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94846

  18. Simon Praetorius uploaded patch set 10 CR +1 V +1 02/02/26, 19:04

  19. Simon Praetorius voted on patch set 10 CR +1 V +1 02/02/26, 19:04

  20. core-ci voted on patch set 10 V +1 02/02/26, 19:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94848

  21. Simon Praetorius commented on patch set 10 02/02/26, 19:18

    I just validated manually that this worked in TYPO3 v12 and stopped working in v13, so the backport is valid imho.

    TemplatesPathsTest.php:274

    Just for reference: This is now covered by `onlyDefaultPaths` above.
  22. Garvin Hicking voted on patch set 10 CR +1 V +1 02/03/26, 08:52

  23. Dmitry Dulepov commented on patch set 10 02/03/26, 09:00

    TemplatesPathsTest.php:274 Reply

    Thank you! 👍
  24. Simon Praetorius voted on patch set 10 CR +2 V +2 02/03/26, 09:19

  25. Simon Praetorius merged patch set 11 02/03/26, 09:20