Review main Merged

51462[TASK] Use strict comparison for strings

Georg Ringer CR +2 V +2 Hard +498 −498 updated 02/01/17, 06:20

Commit message

Change string comparison for string checks. Checks which could lead
to false positives like comparing with '0' or '' are excluded.
RegEx used to find affected places: (?<=\s)((?:!|=)=)(?=[^=]'[^0-9'\n]+')

Review

  • Code review CR +2
    • Benni Mack +2
    • Stefan Neufeind +1
    • Markus Klein +1
  • Verified V +2
    • Benni Mack +2
    • Markus Klein +1
    • TYPO3com +1 CI

Issues 1

Files 110

Show 90 more files

Review log 1722

  1. Georg Ringer uploaded patch set 1 01/30/17, 06:43

  2. TYPO3com voted on patch set 1 V -1 01/30/17, 06:51 Completed build in 07m 51s on Mon, 30 Jan, 07:51 AM Test Summary: 54 of 55659 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7201

  3. Georg Ringer uploaded patch set 2 01/30/17, 07:14

  4. TYPO3com voted on patch set 2 V +1 01/30/17, 07:21 Completed build in 06m 57s on Mon, 30 Jan, 08:21 AM Test Summary: 55655 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7202

  5. Markus Klein commented on patch set 2 CR -1 01/30/17, 10:43

    InlineRecordContainer.php:387

    should stay NEW
  6. Markus Klein commented on patch set 2 01/30/17, 10:50

    TimeTracker.php:512

    FILE

    ext-all-debug.js:34046

    === too in JS files

    SpellCheckingController.php:436

    ===
  7. Georg Ringer uploaded patch set 3 01/30/17, 18:06

  8. TYPO3com voted on patch set 3 V +1 01/30/17, 18:15 Completed build in 08m 52s on Mon, 30 Jan, 07:15 PM Test Summary: 55655 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7242

  9. Christian Weiske commented on patch set 3 01/30/17, 18:52

    Is this really bug #79549, or is that number a typo?
  10. Georg Ringer updated the commit message in patch set 4 01/31/17, 08:55

  11. TYPO3com voted on patch set 4 V +1 01/31/17, 09:02 Completed build in 07m 11s on Tue, 31 Jan, 10:02 AM Test Summary: 55655 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7266

  12. Claus Due commented on patch set 4 01/31/17, 18:08

    Phew, this could really give some problems with edge cases. Some extremely important classes such as DataHandler, ReferenceIndex, RelationHandler may very well depend on not doing strict checks. Good that you left out potentially false positives but we *really* need to be extremely careful here. 410 evaluations is a LOT of space for problems to hide.
  13. Markus Klein uploaded patch set 5 01/31/17, 18:38

  14. Markus Klein voted on patch set 5 CR +1 V +1 01/31/17, 18:42

  15. TYPO3com voted on patch set 5 V +1 01/31/17, 18:46 Completed build in 08m 28s on Tue, 31 Jan, 07:46 PM Test Summary: 55655 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7287

  16. Jigal van Hemert commented on patch set 5 01/31/17, 20:45

    There are quite a few "dangerous" cases where it isn't really clear if the first operand is a string; this could change behaviour. A small note that is easy to fix: the commit message says "Resolves" instead of "Releases".
    Releases:

    NewContentElementController.php:494

    This is a dangerous one. If $config['type'] is for some reason a number or resource it would previously convert 'select' to a number too.

    EditDocumentController.php:610

    Dangerous. $tableName as number would previously forced a numeric comparison.

    EditDocumentController.php:652

    Dangrous; could previously trigger a numeric comparison.
  17. Markus Klein commented on patch set 5 01/31/17, 21:38

    @Jigal: If those cases cause an issue in any direction, I really opt to fix the calling code, because that would be broken beyond repair then.

    NewContentElementController.php:494 Reply

    I don't get that one. I mean if type is something else than a string then the whole thing is broken anyway.

    EditDocumentController.php:610 Reply

    So this very expression would be true iff $tableName = 0

    EditDocumentController.php:652 Reply

    nope. getNewIconMode returns a string (the result of trim())
  18. Stefan Neufeind commented on patch set 5 01/31/17, 23:08

    I'm with Markus here. If some variable could have been a non-string there in the past and something "worked" because of that it wasn't working correct/as expected until now imho, calls for a fix.
  19. Stefan Neufeind voted on patch set 5 CR +1 01/31/17, 23:08

  20. Benni Mack voted on patch set 5 CR +2 02/01/17, 05:33

  21. Benni Mack voted on patch set 5 V +2 02/01/17, 06:20

  22. Gerrit merged patch set 5 02/01/17, 06:20