Review main Merged

74364[BUGFIX] Name invalid identifier in UpgradeWizard exception

J. Peter M. Schuler CR +2 V +2 Easy +11 −2 updated 04/23/22, 17:37

Commit message

An exception will be raised, if an upgrade wizard identifier
returned by "UpgradeWizardInterface::getIdentifier()" is not
valid due to e.g. misspelling.

The invalid identifier is now mentioned in the exception
message for easier debugging.

In addition, the exception is now split up into two separate
exceptions in order to define the reason more precisely.

Review

  • Code review CR +2 Done
    • Helmut Hummel +2
    • Oliver Klee +1
    • Stefan Bürk +1
    • Nikita Hovratov +1
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Helmut Hummel +2
    • Stefan Bürk +1
    • Nikita Hovratov +1
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 3139

Show 1014 earlier messages
  1. J. Peter M. Schuler uploaded patch set 1 04/20/22, 20:36

  2. Oliver Klee voted on patch set 1 CR +1 04/20/22, 20:44

  3. Stefan Bürk commented on patch set 1 04/20/22, 20:47

    Thanks for this patch. Left some minor remarks.
    Would handle this more as a bugfix than a simple task. Any maybe we can make the line a little bit smaller. Would would you say to: ``` [BUGFIX] Name invalid identifier in UpdateWizard exception ```
    Not a "priority/security" bugfix, also helpful. So normaly no candidate for v10 anymore.

    UpgradeWizardsService.php:469

    Displaying empty $identifer seems kind of contra-productive. If empty should be rephrased to "no identifer given" or something like that. In the end, if given but invalid it's really good to display it.
  4. J. Peter M. Schuler uploaded patch set 2 04/20/22, 20:47

  5. J. Peter M. Schuler updated the commit message in patch set 3 04/20/22, 20:49

  6. core-ci voted on patch set 1 V -1 04/20/22, 20:51 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26250

  7. core-ci voted on patch set 2 V +1 04/20/22, 20:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26251

  8. core-ci voted on patch set 3 V +1 04/20/22, 21:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26252

  9. Oliver Klee voted on patch set 3 CR +1 04/20/22, 21:28

  10. Jonas Eberle commented on patch set 3 04/21/22, 06:08

    UpgradeWizardsService.php:469 Reply

    I also think that while we are at it we could mention which of the cases was not satisfied to provide more helpful Exception texts.
  11. Mathias Brodala commented on patch set 3 04/21/22, 06:50

    UpgradeWizardsService.php:469

    This should be split into three checks with separate exceptions: > Empty wizard identifier given And: > Wizard identifier "%s" not found in $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'] The latter also gives a hint where to look for the errors. And: > Wizard identifier "%s" does not implement the RowUpdaterInterface
  12. J. Peter M. Schuler uploaded patch set 4 04/21/22, 13:13

  13. core-ci voted on patch set 4 V +1 04/21/22, 13:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26271

  14. Mathias Brodala commented on patch set 4 CR -1 04/21/22, 13:24

    UpgradeWizardsService.php:477

    and
  1. Oli Bartsch commented on patch set 4 CR -1 04/21/22, 20:38

    UpgradeWizardsService.php:469

    Since we changed the message, let's use a new code here as well.

    UpgradeWizardsService.php:473

    Should be || However, as Mathias suggested, we should split this as well, having dedicated exceptions.
  2. Oli Bartsch commented on patch set 4 04/21/22, 20:39

    Reply

    Done

    Reply

    Done
  3. J. Peter M. Schuler uploaded patch set 5 04/21/22, 22:26

  4. J. Peter M. Schuler commented on patch set 5 04/21/22, 22:27

    Reply

    Done

    Reply

    Done

    UpgradeWizardsService.php:469 Reply

    I'd myself rather not touch that, as I don't know if it then should have the same exception ID for backwards compatibility, or get a new unique ID and then which gets the new one (while loosing the wiki knowledge for the ID). (as the wiki has no entry this concern is irrelevant). Additionally having empty quotes will make it clear it was empty string and probably this scenario is only valid for admins and maintainers anyways, so my humble mind sees no deterioration, although I get there is much potential for further improvement.

    UpgradeWizardsService.php:469 Reply

    Ack and done. (Except the last two are <not>&&<not>, so it is still one exception, as one needs to do at least one, but can only do one).

    UpgradeWizardsService.php:469 Reply

    Done

    UpgradeWizardsService.php:473 Reply

    Could anybody explain why it should be an OR? it was always an AND. And the AND makes sense, as it might be meaningful to have an identifier which isn't the class name. I always thought the is_subclass_of was either a fallback to catch broken registration or a auto detection thing to avoid that old TYPO3_CONF_VARS.

    UpgradeWizardsService.php:477 Reply

    The exception says "not X && not Y => throw exception", so if either is true, it won't throw an exception. I'm not saying if or if not the if is correct semantically, but "my" exception text matches the condition.
  5. core-ci voted on patch set 5 V -1 04/21/22, 22:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26289

  6. Mathias Brodala commented on patch set 5 04/22/22, 06:45

    UpgradeWizardsService.php:473 Reply

    As one can see even these two lines already have too much complexity, especially since there are two completely unrelated things checked together. So by all means, let's split this into two checks. Having a changed code here for one of the two errors should not be a deal-breaker.
  7. Mathias Brodala commented on patch set 5 04/22/22, 11:21

    UpgradeWizardsService.php:473 Reply

    After some further discussion I finally understand the condition. A valid identifier is: 1. not empty 2. registered OR implements RowUpdaterInterface See https://review.typo3.org/c/Packages/TYPO3.CMS/+/59290/
  8. Stefan Bürk commented on patch set 5 CR -1 04/22/22, 17:44

    on it ..
  9. J. Peter M. Schuler commented on patch set 5 04/22/22, 17:46

    UpgradeWizardsService.php:473 Reply

    For documentation of background-discussion: https://github.com/TYPO3/typo3/commit/3b84e6139f2c9e0465ac3d9711f72398ee48f796 introduced this condition. This condition lets RowUpdaters exist which aren't "real" update wizards.
  10. core-ci voted on patch set 5 V +1 04/22/22, 18:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26289

  11. Stefan Bürk commented on patch set 5 V +1 CR +1 04/22/22, 18:06

    core-ci -1 was a hickup. no real issue. Retried pipeline. (Sry for this, but tackling these ssl issue is not quite easy - we are aware of it and working on it).

    UpgradeWizardsService.php:473 Reply

    Okay, to clear here some things up: 1. @Oliver: nope, && is here correct. This is a negated check to state this if $identifier is not registered properly AND not a RowUpdater. Thus the && check is correct and needed. 2. @Brodala: I would not split this - as splitting means to have for each splitted part more complex conditions. This one is quite quite fine. 3. Using "or" in the expection message is correct, despite the && in the condition Generally this is straight forwared - maybe through some thinking around the corner some confussion popped up - and was not my indent with the first "lets handly an empty identifier" comment. So splitting out the "empty" one is quite the correct way, with a dedicated exception code (which has to be unique through core policies). After checking the patch out, reading all the comments - the patch now is in the correct form.

    UpgradeWizardsService.php:477 Reply

    Absolutly right Peter. "or" is absolutly correct here.
  12. Nikita Hovratov commented on patch set 5 CR -1 04/22/22, 18:32

    On it
  13. Stefan Bürk wrote 04/22/22, 18:36

    Removed Code-Review+1 by Stefan Bürk
  14. Stefan Bürk wrote 04/22/22, 18:36

    Removed Verified+1 by Stefan Bürk
  15. Nikita Hovratov uploaded patch set 6 04/22/22, 18:45

  16. Nikita Hovratov commented on patch set 6 V +1 CR +1 04/22/22, 18:46

    Patch was fine, just added some cosmetics.
  17. Stefan Bürk updated the commit message in patch set 7 04/22/22, 18:54

  18. Stefan Bürk voted on patch set 7 V +1 CR +1 04/22/22, 18:54

  19. Nikita Hovratov voted on patch set 7 V +1 CR +1 04/22/22, 18:55

  20. core-ci voted on patch set 6 V +1 04/22/22, 18:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26316

  21. core-ci voted on patch set 7 V +1 04/22/22, 19:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26317

  22. Oliver Klee voted on patch set 7 CR +1 04/22/22, 19:06

  23. Simon Schaufelberger voted on patch set 7 V +1 CR +1 04/23/22, 15:19

  24. Helmut Hummel voted on patch set 7 V +2 CR +2 04/23/22, 17:37

  25. Helmut Hummel merged patch set 8 04/23/22, 17:37