Review main Merged

73692[TASK] Validate regex validator pattern in form editor

Elias Häußler CR +2 V +2 Normal +77 −14 updated 04/27/22, 13:21

Commit message

In the form editor, backend users can currently insert any non-empty
strings for patterns of regular expression validators. This can lead to
situations where invalid pattern are inserted without getting immediate
feedback. Rather, this generates an error to the user when rendering the
form in the frontend.

To avoid those situations, backend users will now get an immediate
visual feedback if the inserted regex pattern is not valid. The
underlying check is rather basic and does not support all features of
PHP PCRE regular expressions. Since the RegularExpressionValidator
will be removed from the UI in v13, the improvement is suitable in
respect of the removal (see #97016). However, this is still a small
progress in this area.

Review

  • Code review CR +2 Done
    • waldhacker +2
    • Björn Jacob +1
    • Tobias Jungmann +1
  • Verified V +2 Done
    • waldhacker +2
    • Björn Jacob +1
    • Tobias Jungmann +1
    • core-ci +1 CI

Issues 1

Files 34

Show 14 more files

Review log 1721

  1. Elias Häußler uploaded patch set 1 02/24/22, 10:23

  2. core-ci voted on patch set 1 V +1 02/24/22, 10:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24173

  3. Stefan Bürk commented on patch set 1 02/24/22, 12:03

    Does this needs adoption from instances on upgrade in there form yamls ??? I would rather call this a FEATURE than a TASK - or do I miss something ?
  4. Elias Häußler commented on patch set 1 02/24/22, 14:29

    Reply

    No, this should not have an impact on existing `.form.yaml` files. It's more an additional "safety" layer to prevent editors from defining an invalid regex pattern leading to an exception to the frontend user. Since this is just one more step on the way to remove the RegularExpressionValidator from backend form editor (the deprecation already comes via https://review.typo3.org/c/Packages/TYPO3.CMS/+/73689), I'd say it's clearly a TASK. But maybe it's worth an Important RST that explains the background? Furthermore, the underlying check only respects "/" as regex delimiter (so for example #.+# is not "valid" here), which might lead to problems in some cases. We could add a hint on how to disable the newly introduced "safety check".
  5. Tobias Jungmann commented on patch set 1 CR -1 04/27/22, 09:51

    formEditor.rst:111

    Indent is not correct.

    formEditor.rst:236

    Indent

    Database.xlf:293

    Used tabs instead of spaces.
  6. Tobias Jungmann voted on patch set 1 V +1 04/27/22, 09:56

  7. Björn Jacob uploaded patch set 2 04/27/22, 11:01

  8. Björn Jacob commented on patch set 2 04/27/22, 11:04

    formEditor.rst:111 Reply

    Done

    formEditor.rst:236 Reply

    Done

    Database.xlf:293 Reply

    Done
  9. Tobias Jungmann voted on patch set 2 CR +1 04/27/22, 11:04

  10. Tobias Jungmann voted on patch set 2 V +1 04/27/22, 11:06

  11. Björn Jacob updated the commit message in patch set 3 04/27/22, 11:10

  12. core-ci voted on patch set 2 V +1 04/27/22, 11:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26501

  13. core-ci voted on patch set 3 V +1 04/27/22, 11:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26502

  14. Björn Jacob voted on patch set 3 CR +1 04/27/22, 11:19

  15. Björn Jacob updated the commit message in patch set 4 04/27/22, 11:19

  16. Björn Jacob voted on patch set 4 CR +1 04/27/22, 11:20

  17. core-ci voted on patch set 4 V +1 04/27/22, 11:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26503

  18. Björn Jacob commented on patch set 4 V +1 04/27/22, 12:27

    Awesome. Tested with "0" and "/ba(na){2}/i".
  19. Tobias Jungmann voted on patch set 4 V +1 CR +1 04/27/22, 12:28

  20. waldhacker voted on patch set 4 V +2 CR +2 04/27/22, 13:21

  21. waldhacker merged patch set 5 04/27/22, 13:21