Review main Merged

81645[BUGFIX] Handle empty values with FormEngine radio fields

Garvin Hicking CR +2 V +2 Normal +198 −27 updated 11/21/23, 18:43

Commit message

The bug report #102303 indicates that a TCA element type=radio
with items containing an empty string do not get properly
restored/persisted in FormEngine (Backend GUI input fields).

This is because empty attributes from HTML `<input>` fields are
not evaluated, and thus not restored and stored properly when
selected. `GeneralUtility::implodeAttributes()` calls do not
utilize the `keepBlankAttributes` parameter.

The report specifically mentions radio Element types, but also
effects checkboxes and `<option>` tags. An option tag without
a value submits the label of the option instead of an empty
value, so the attribute `value=""` is important.

The `CategoryElement` and `JsonElement` both already use
the parameter `keepBlankAttributes`, so the older FormEngine
Elements were probably not re-investigated.

See #102303 on details how to test this patch.

Docs [1] currently do not mention that "value" may not be
an empty string.

New acceptance tests are introduced to cover checking for the
ability to set and retrieve radio selection states.
EXT:styleguide is enhanced to also put empty elements into
the mix. Another acceptance test is stabilized along the way.

[1] https://docs.typo3.org/m/typo3/reference-tca/main/en-us/ColumnsConfig/Type/Radio/Properties/Items.html

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Stefan Bürk +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 1

Files 8

Review log 2539

Show 1014 earlier messages
  1. Garvin Hicking uploaded patch set 1 11/02/23, 12:26

  2. Garvin Hicking updated the commit message in patch set 2 11/02/23, 12:30

    Change formatting of commit message
  3. core-ci voted on patch set 1 V +1 11/02/23, 12:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48483

  4. core-ci voted on patch set 2 V +1 11/02/23, 12:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48484

  5. Simon Schaufelberger commented on patch set 2 11/02/23, 14:03

    possible -> probably
    please no test in the commit message. this belongs into the forge issue. please also create a test that covers this case.
  6. Simon Schaufelberger commented on patch set 2 11/02/23, 14:04

    please rebase your patch and add test case to the styleguide extension
  7. Garvin Hicking commented on patch set 2 11/02/23, 17:43

    Thanks for looking into it; gave some feedback, generally I'd love to hear feedback on whether this is regarded as a bug and we can continue with the approach.

    Reply

    I will do so when this fix generally gets approval!

    Reply

    Ack

    Reply

    I will remove the test from the commit message at a later point, I found it easier to read it here in one go while this gets checked from others. However I'll also add it to the issue. How can I create a test for this, can you give me a examples or an outline? I don't really know how. Also, I would only put time and effort into this if the fix is generally accepted/agreed on.
  8. Garvin Hicking uploaded patch set 3 V +1 11/02/23, 19:07

    Added styleguide patch and shorten commit message
  9. Garvin Hicking commented on patch set 3 11/02/23, 19:09

    Reply

    Added the example to the styleguide extension, thanks!

    Reply

    Done

    Reply

    I shortened the commit message, moved the testing instructions to the ticket, thanks for the suggestion. :-) Also I addressed the "TODO" section about missing functional/acceptance tests for this.
  10. core-ci voted on patch set 3 V +1 11/02/23, 19:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48512

  11. Simon Schaufelberger commented on patch set 3 11/02/23, 19:40

    Reply

    The styleguide extension has a ton of tests, just include your test case into it.
  12. Garvin Hicking commented on patch set 3 11/03/23, 08:20

    Reply

    Could you point me to one you think is "close" to it? The styleguide extension has exactly one UnitTest for "Kauderwelschservice" only https://github.com/TYPO3/typo3/tree/main/typo3/sysext/styleguide/Tests/Unit/Service I would need something to test like: * Display a specific field in FormEngine (here: radio option with empty value) - Acceptance browser remote control? * "Save" a record - also Acceptance remote control? Subrequest? * Compare if the saved record holds the expected value - Is the above synchronous, so that I can check the record after the action is performed? I have never used the acceptance "browser remote control" tests yet and it would help me a lot of you could point me into a specific direction, thank you!
  13. Garvin Hicking updated the commit message in patch set 4 V +1 11/03/23, 09:57

    Update title to better reflect importance
  14. core-ci voted on patch set 4 V +1 11/03/23, 10:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48532

  1. Garvin Hicking uploaded patch set 5 V +1 11/08/23, 18:58

    Rebase and add stub acceptance test
  2. core-ci voted on patch set 5 V -1 11/08/23, 19:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48729

  3. Garvin Hicking uploaded patch set 6 V -1 11/08/23, 19:19

    Disable non working test for now
  4. core-ci voted on patch set 6 V +1 11/08/23, 19:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48730

  5. Garvin Hicking uploaded patch set 7 V +1 11/09/23, 18:10

    Work on acceptance test with radio
  6. core-ci voted on patch set 7 V +1 11/09/23, 18:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48762

  7. Garvin Hicking uploaded patch set 8 V +1 11/10/23, 10:49

    Add empty element check to acceptance test
  8. Garvin Hicking commented on patch set 8 11/10/23, 10:52

    Reply

    Ack
    I've now added acceptance tests, and they are able to check this scenario. Without the patch to RadioElement applied, the test will fail because radio states are not retrievable. With it, the tests succeed. Would love some feedback on how/if to proceed with this :-)

    Reply

    I've now added an acceptance test for this :-)
  9. core-ci voted on patch set 8 V +1 11/10/23, 10:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48786

  10. Simon Schaufelberger voted on patch set 8 V +1 CR +1 11/18/23, 15:37

  11. Simon Schaufelberger commented on patch set 8 11/18/23, 15:39

    the commit message is not parsed with REST, thus making the :php: prefix useless
  12. Garvin Hicking uploaded patch set 9 CR +1 V +1 11/21/23, 11:41

    Reduced scope of change to only affect checkbox radio option elements
  13. Garvin Hicking uploaded patch set 10 11/21/23, 11:43

    Removed two remaining usages
  14. core-ci voted on patch set 9 V +1 11/21/23, 11:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49215

  15. core-ci voted on patch set 10 V +1 11/21/23, 11:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49217

  16. Christian Kuhn commented on patch set 10 11/21/23, 15:01

    Reply

    Done
  17. Christian Kuhn uploaded patch set 11 V +1 11/21/23, 15:19

  18. core-ci voted on patch set 11 V +1 11/21/23, 15:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49248

  19. core-ci voted on patch set 11 V -1 11/21/23, 15:36 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49249

  20. Christian Kuhn uploaded patch set 12 V -1 11/21/23, 18:23

  21. core-ci voted on patch set 12 V +1 11/21/23, 18:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49282

  22. core-ci commented on patch set 12 11/21/23, 18:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49283

  23. Stefan Bürk voted on patch set 12 V +1 CR +1 11/21/23, 18:43

  24. Christian Kuhn voted on patch set 12 V +2 CR +2 11/21/23, 18:43

  25. Christian Kuhn merged patch set 13 11/21/23, 18:43