Review main Merged

72767[BUGFIX] Properly reset form renderable validators

Elias Häußler CR +2 V +2 Normal +73 −2 updated 02/24/22, 17:16

Commit message

Since form renderable validators are stored as SplObjectStorage
instances, it is currently impossible to properly reset those
validators, e.g. within a configured variant in the form configuration.
This is because detaching during a foreach over SplObjectStorage
instances updates the internal pointer. This leads to inconsistent
behavior in the foreach loop.

To come around this issue, a cloned SplObjectStorage is now used to
remove all currently registered validators, properly resetting all
validators for the form renderable. Additionally, this edge case is now
covered by a functional test case.

Review

  • Code review CR +2 Done
    • waldhacker +2
    • Oliver Hader +1
  • Verified V +2 Done
    • waldhacker +2
    • Oliver Hader +1
    • core-ci +1 CI

Issues 1

Files 3

Review log 1926

Show 1 earlier messages
  1. Elias Häußler uploaded patch set 1 12/21/21, 18:01

  1. Elias Häußler rebased onto patch set 2 12/21/21, 18:02

  2. core-ci voted on patch set 1 V -1 12/21/21, 18:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21375

  3. core-ci voted on patch set 2 V -1 12/21/21, 18:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21376

  4. Elias Häußler uploaded patch set 3 12/21/21, 18:06

  5. core-ci voted on patch set 3 V +1 12/21/21, 18:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21377

  6. Elias Häußler wrote 12/22/21, 14:09

    Topic set to form
  7. Benni Mack commented on patch set 3 CR +1 01/06/22, 14:29

    Hey Ralf, change looks legit, can you approve?
  8. Oli Bartsch voted on patch set 3 V +1 CR +1 01/06/22, 14:37

  9. Björn Jacob rebased onto patch set 4 02/23/22, 10:14

  10. core-ci voted on patch set 4 V -1 02/23/22, 10:22 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24086

  11. Elias Häußler uploaded patch set 5 02/23/22, 10:51

  12. core-ci voted on patch set 5 V +1 02/23/22, 10:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24090

  13. Elias Häußler rebased onto patch set 6 02/23/22, 11:00

  14. core-ci voted on patch set 6 V +1 02/23/22, 11:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24092

  15. waldhacker voted on patch set 6 CR +1 02/23/22, 14:04

  16. waldhacker commented on patch set 6 02/23/22, 14:23

    Reply

    Sorry, line 82 not 83
  17. Elias Häußler uploaded patch set 7 02/23/22, 15:08

  18. Elias Häußler commented on patch set 7 02/23/22, 15:09

    Reply

    Thanks for the hint! I was able to verify the problem there as well and pushed an update.
  19. core-ci voted on patch set 7 V +1 02/23/22, 15:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24114

  20. waldhacker voted on patch set 7 CR +1 02/23/22, 15:50

  21. Oliver Hader commented on patch set 7 V +1 CR +1 02/23/22, 16:16

    What about adding the following to ProcessingRule ``` public function resetValidators(): void { $storage = $this->validator->getValidators(); $storage->removeAll($storage); } ``` And then just call

    AbstractRenderable.php:167 Unresolved

    Looks odd, but actually is like `getArrayCopy` for `ArrayObject` instances. In general this might be simplified here a bit in the future: * using `$processingRule->getValidators()` instead * for removing all validators, e.g. consider creating a new instance of `ConjunctionValidator` in `ProcessingRule` instead
  22. Oliver Hader commented on patch set 7 02/23/22, 16:35

    Reply

    Ignore that one... `resetValidators` currently would be just called once...
  23. waldhacker voted on patch set 7 V +2 CR +2 02/24/22, 17:16

  24. waldhacker merged patch set 8 02/24/22, 17:16