Review main Merged

42081[BUGFIX] use array_key_exists() to deal correctly with NULL values

Jo Hasenau CR +2 V +2 Easy +6 −3 updated 08/06/15, 12:20

Commit message

Review

  • Code review CR +2
    • Christian Kuhn +2
    • Stefan Neufeind +1
    • Tomas Norre Mikkelsen +1
    • Markus Klein +1
    • Wouter Wolters +1
  • Verified V +2
    • Christian Kuhn +2
    • Markus Klein +1

Issues 1

Files 1

Review log 24

  1. Jo Hasenau uploaded patch set 1 07/29/15, 08:16

  2. Stefan Neufeind commented on patch set 1 CR +1 07/29/15, 09:33

    Sounds valid. Could you please check if similar cases (from a same patch-source using isset?) exist elsewhere?
  3. Jo Hasenau commented on patch set 1 07/29/15, 09:51

    Will do
  4. Jo Hasenau commented on patch set 1 07/29/15, 09:58

    AFAICS the other patches that actually introduced isset() have been abandoned, still there might be other cases where isset() has always been used, although it should be array_key_exists.
  5. Stefan Neufeind commented on patch set 1 07/29/15, 10:21

    I'm adding Markus here, since he's our master of typecasts and all strange if-condition-things :-)
  6. Jo Hasenau commented on patch set 1 07/29/15, 10:24

    Since there are 3000+ hits for isset() in the core, I guess we should stick to small patches for certain issues. Otherwise we will get another patch monster that breaks some of the issues we actually wanted to fix. ;-)
  7. Jo Hasenau commented on patch set 1 07/29/15, 10:59

    Checked the values in the DB and found that the patch just partly fixes the problem, since it replaces NULL with "empty" now instead of 0. Seems we need more than just the array key to handle NULL correctly. On the other hand "empty" would be enough for the structured content stuff - but still the method does not work correctly and should be fixed.
  8. Jo Hasenau uploaded patch set 2 07/29/15, 12:05

  9. Jo Hasenau commented on patch set 2 07/29/15, 12:06

    Found another one in the datahandler - other appearances of recordInfo are not checked with isset() AFAICS. Additionally fields that can have NULL as a value must be set to at least "eval" => "null" otherwise there will be an empty string in the DB.
  10. Jo Hasenau commented on patch set 2 07/29/15, 13:04

    "eval" => "null" seems to produce a visible checkbox in the editing form with fields of the type "select" - so either this is another bug we have to fix, or "eval" is not supposed to work with certain field types.
  11. Jo Hasenau commented on patch set 2 07/29/15, 14:51

    Will take care about the "eval" stuff within the structured content issues - for this issue it's enough to fix the buggy behaviour, so NULL values can be handled correctly while copying records.
  12. Tomas Norre Mikkelsen voted on patch set 2 CR +1 07/29/15, 19:31

  13. Frederic Gaus voted on patch set 2 CR +1 07/30/15, 08:21

  14. Stefan Neufeind voted on patch set 2 CR +1 07/30/15, 08:22

  15. Markus Klein commented on patch set 2 07/30/15, 10:37

    Pls add comments in the code why we use the array_key_exists() here. Those few exceptions should be well documented, otherwise they might be removed again due to lack of knowing better.
  16. Jo Hasenau uploaded patch set 3 07/30/15, 11:21

  17. Jo Hasenau uploaded patch set 4 07/30/15, 11:23

  18. Jo Hasenau commented on patch set 4 07/30/15, 11:25

    Done - Patchset 4 was necessary due to whitespace issues - sometimes it's a bit confusing with CGL tabs and PSR spaces ;-)
  19. Stefan Neufeind voted on patch set 4 CR +1 07/30/15, 11:42

  20. Markus Klein commented on patch set 4 CR +1 V +1 07/30/15, 12:06

    thanks
  21. Wouter Wolters voted on patch set 4 CR +1 07/30/15, 12:10

  22. Tomas Norre Mikkelsen voted on patch set 4 CR +1 08/01/15, 19:05

  23. Christian Kuhn commented on patch set 4 V +2 CR +2 08/06/15, 12:15

    yeah. i came across similar scenarios in formEngine recently and i'm pretty sure this patch is ok.
  24. Christian Kuhn merged patch set 4 08/06/15, 12:20