Review main Merged

50284[BUGFIX] Prevent malformed SQL query in AbstractDatabaseRecordList

Claus Due CR +2 V +2 Easy +2 −2 updated 10/21/16, 12:30

Commit message

This change prevents the creation of a malformed SQL query in
AbstractDatabaseRecordList::makeQueryArray. The problem was
caused by the makeSearchString method returning `1=1` from two
early decisions, whereas before it would return a valid query
prepended with AND but containing no search clauses.

Returning an empty string from these two early decisions will
completely solve the issue without breaking the search feature
that uses this function.

Review

  • Code review CR +2
    • Benni Mack +2
    • Markus Klein +1
    • Wouter Wolters +1
    • Christian Kuhn +1
  • Verified V +2
    • Benni Mack +2
    • Christian Kuhn +1
    • TYPO3com +1 CI

Issues 1

Files 1

Review log 1819

  1. Claus Due uploaded patch set 1 10/19/16, 21:25

  2. TYPO3com voted on patch set 1 V +1 10/19/16, 21:29 Completed build in 04m 32s on Wed, 19 Oct, 11:29 PM Test Summary: 19567 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-3936

  3. Markus Klein voted on patch set 1 CR +1 V +1 10/20/16, 09:56

  4. Wouter Wolters voted on patch set 1 CR +1 10/20/16, 09:59

  5. Benni Mack commented on patch set 1 10/20/16, 10:27

    AbstractDatabaseRecordList.php:919

    actually, when looking at the code how it was in 7.6, it returned "AND 0=1"
  6. Claus Due commented on patch set 1 10/20/16, 10:37

    Trying now that this also would solve it. If no other guards are made for this, the change would indeed return all results for those two cases.
  7. Claus Due commented on patch set 1 10/20/16, 10:43

    Tested now - returning any automatically negative match like `0=1` from the function causes the page module to not show anything at all. Any returned condition prefixed or suffixed with AND causes another type of SQL error (the condition is inserted in parenthesis). It truly does look like the migrations have changed this requirement to an empty string or something automatically true like 1=1 (in which case an empty string would be just as fine I guess). Question is: should I change this to 1=1 or do we prefer an empty string?
  8. Markus Klein commented on patch set 1 10/20/16, 10:48

    The return comment says "if applicable" hence I prefer empty string
  9. Markus Klein commented on patch set 1 10/20/16, 10:49

  10. Markus Klein commented on patch set 1 CR 0 V 0 10/20/16, 10:54

    To be precise: https://review.typo3.org/#/c/48948/3/typo3/sysext/recordlist/Classes/RecordList/AbstractDatabaseRecordList.php I added the second 1=1 thing, because the function was lacking a return statement.
  11. Markus Klein voted on patch set 1 CR +1 10/20/16, 10:54

  12. Claus Due commented on patch set 1 10/20/16, 11:05

    I also tested the behavior of the search - if you enter an empty query (which these cases seem to be for) the search dialog now closes itself and simply shows all items. All looks well!
  13. Christian Kuhn commented on patch set 1 CR -1 10/21/16, 10:44

    on it.
  14. Christian Kuhn commented on patch set 1 10/21/16, 11:47

    running that patch through ac tests now.
  15. Christian Kuhn voted on patch set 1 CR +1 V +1 10/21/16, 11:48

  16. Christian Kuhn voted on patch set 1 V 0 10/21/16, 11:49

  17. Christian Kuhn voted on patch set 1 V +1 10/21/16, 11:56

  18. Benni Mack voted on patch set 1 CR +2 V +2 10/21/16, 12:30

  19. Gerrit merged patch set 1 10/21/16, 12:30