Review main Merged

86439[TASK] Remove unnecessary ?? operator for regex matches

Markus Klein CR +2 V +2 Easy +2 −12 updated 10/07/24, 15:47

Commit message

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Thomas Hohn +1
    • Christian Kuhn +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 1

Files 3

Review log 2125

  1. Markus Klein uploaded patch set 1 10/07/24, 07:26

  2. Markus Klein updated the commit message in patch set 2 10/07/24, 07:28

  3. Markus Klein marked it ready for review 10/07/24, 07:28

  4. Thomas Hohn voted on patch set 2 CR +1 10/07/24, 07:40

  5. core-ci voted on patch set 1 V -1 10/07/24, 07:44 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67205

  6. core-ci voted on patch set 2 V -1 10/07/24, 07:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67206

  7. Markus Klein uploaded patch set 3 CR +1 V -1 10/07/24, 08:32

  8. Benjamin Franzke commented on patch set 3 CR -1 10/07/24, 08:37

    CKEditor5Migrator.php:715

    It can not be correct to remove escaping here. `*` was escaped on purpose by ckeditor upstream (see comment above where this regex has been copied from), as `*` is part of the input string and not meant as "zero or more occurrences" asterisk.
  9. Markus Klein commented on patch set 3 10/07/24, 08:41

    CKEditor5Migrator.php:715 Reply

    * inside a character class is a literal, always.
  10. Markus Klein commented on patch set 3 10/07/24, 08:42

    CKEditor5Migrator.php:715 Reply

    `*` inside a character class is a literal
  11. Markus Klein commented on patch set 3 10/07/24, 08:44

    CKEditor5Migrator.php:715 Reply

    They also didn't escape it here either `[a-z0-9\-*\s]+`, which is correct.
  12. Markus Klein commented on patch set 3 10/07/24, 08:48

    CKEditor5Migrator.php:715

    But this `]` was meant literal, hence the escaping needs to stay. Will revise
  13. core-ci voted on patch set 3 V +1 10/07/24, 08:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67210

  14. Markus Klein commented on patch set 3 10/07/24, 08:53

    CKEditor5Migrator.php:715 Reply

    Albeit, strictly speaking: since there is no opening character class for this one, it would be interpreted as literal `]` anyways. PHP storm inspection actually marks this as redundant. ```php preg_match('#\[[af]+]#', '[fa]', $matches); ``` this matches correctly. So the current patch set is okay; no need to put those `\` back in.
  15. Benjamin Franzke commented on patch set 3 CR +1 10/07/24, 09:12

    CKEditor5Migrator.php:715 Reply

    Acknowledged

    CKEditor5Migrator.php:715 Reply

    Acknowledged
  16. Benjamin Franzke commented on patch set 3 CR -1 10/07/24, 09:15

    CKEditor5Migrator.php:715

    but this bracket should have stayed to be escaped, right? it referers to the `\[` prior to the character class.
  17. Markus Klein commented on patch set 3 10/07/24, 09:18

    CKEditor5Migrator.php:715 Reply

    As noted above, that's correct. But we move this to a dedicated change, so we get that one in.
  18. Markus Klein uploaded patch set 4 CR -1 V +1 10/07/24, 09:19

  19. Benjamin Franzke commented on patch set 4 CR +1 V +1 10/07/24, 09:22

    CKEditor5Migrator.php:715 Reply

    should be explained by https://review.typo3.org/c/Packages/TYPO3.CMS/+/86439/3#message-6c512d33b2f17fc10c866cae3fdeded084b415a3 – but I don't quite get it yet, because I still think this is wrong, because a closing bracket should not be unescaped only because there is no matching opening bracket (I wouldn't follow phpstorm's recommentation here). Ack, let's keep that for separate change.
  20. Markus Klein commented on patch set 4 10/07/24, 09:28

    CKEditor5Migrator.php:715 Reply

    this bracket-mismatch is actually okay. a closing bracket is a literal unless you are in a character class. (at least PCRE handles it like that, not sure about the other engines)
  21. core-ci voted on patch set 4 V +1 10/07/24, 09:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67214

  22. Thomas Hohn voted on patch set 4 CR +1 10/07/24, 15:08

  23. Christian Kuhn voted on patch set 4 CR +1 V +1 10/07/24, 15:46

  24. Benjamin Franzke voted on patch set 4 CR +2 V +2 10/07/24, 15:47

  25. Benjamin Franzke merged patch set 5 10/07/24, 15:47