79474[BUGFIX] Avoid exception for recent documents
Commit message
Review
-
Code review CR +2 Done
- Oli Bartsch +2
- Oliver Klee +1
- Benni Mack +1
-
Verified V +2 Done
- Oli Bartsch +2
- Benni Mack +1
- core-ci +1 CI
Issues 1
Files 1
Review log 1316
-
Stephan Großberndt uploaded patch set 1 06/21/23, 11:08
-
core-ci voted on patch set 1 V +1 06/21/23, 11:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42878
-
Oliver Klee commented on patch set 1 06/21/23, 13:30
Also, I propose covering this with a regression (unit) test.OpendocsToolbarItem.php:147For non-namespaced classes, we usually don't `use` them, but add a leading backslash when they're used: ``` } catch (\Exception) { ``` However, I wonder if we can narrow down the exception class we're catching here. (Catching the `Exception` base class is a code small that indicated that we might be catching too much, which could cause other problems to be swept under rug even if those should bubble up.) Maybe catch the `TableNotFoundException` instead? What do you think? -
Stephan Großberndt uploaded patch set 2
V +106/21/23, 19:25 -
core-ci voted on patch set 2 V +1 06/21/23, 19:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42888
-
Stephan Großberndt commented on patch set 2 06/21/23, 19:35
Reply
Would you help me with this please? If I understood it correctly I would have to set up a mock `BackendUtility::getRecordWSOL()` method that throws a `TableNotFoundException` and then call `OpendocsToolbarItem->getMenuEntry()` which should not fail with the `TableNotFoundException` - but I can't create a mock for `BackendUtility::getRecordWSOL()` because it is a static method.OpendocsToolbarItem.php:147ReplyThere are three other places in core where `use Exception;` is used, so I thought it is ok. Of course it is enough to catch the TableNotFoundException here to avoid the problem I had - I just thought it would be better to catch everything that goes wrong when fetching the record in a list of recent records and display nothing instead like it is done when the record has been deleted instead of breaking the whole backend because of this. If you think TableNotFoundException is enough, I am fine with that. -
Oliver Klee commented on patch set 2 06/22/23, 16:19
Reply
Ah, I see. Yes, indeed, static methods cannot be mocked. Then I propose we'll use a functional test instead. Do you need help with that? (I won't really be able to put time into this in June, but only in July, so if you need help, you might want to try to ask other folks as well, or we work on this together in July if you like.) -
Benni Mack commented on patch set 2 07/05/23, 12:24
Tests will be rather tricky. This would mean that there was a previously opened document from an extension DB table with TCA ("tx_blabla_domain_model_bla"), which then gets uninstalled and then via a DB compare removed in DB, then the editor gets the open docs and gets a fatal error. TBH: I don't know if the testing framework even supports this kind of test (installing and uninstalling, updated core_caches) yet. All in all, this seems overkill for such a fix (and edge-case). However, I would recommend to add a comment to the catch() why this is caught and how this could happen in the first place. -
Stefan Bürk commented on patch set 2 07/05/23, 12:38
Reply
> I don't know if the testing framework even supports this kind of test (installing and uninstalling, updated core_caches) yet. All in all, this seems overkill for such a fix (and edge-case). Not really. I guess calling kind of several core internal methods manually would be needed to archieve that. E.g. calling the xtension uninstall, cetting caches to rewrite/clear inbetweeen and the whol "destructive" database compare stuff. To overkill IMO. -
Oliver Klee commented on patch set 2 07/06/23, 19:09
Reply
Let‘s skip writing the test for now. (I currently don’t have the time to help. Sorry.) -
Benni Mack uploaded patch set 3
V +107/06/23, 19:19 -
Oliver Klee voted on patch set 3 CR +1 07/06/23, 19:22
-
core-ci voted on patch set 3 V +1 07/06/23, 19:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43814
-
Benni Mack voted on patch set 3 V +1 CR +1 07/06/23, 19:52
-
Oli Bartsch voted on patch set 3 V +2 CR +2 07/06/23, 19:53
-
Oli Bartsch merged patch set 4 07/06/23, 19:53