Review 11.5 Merged

74461[BUGFIX] Avoid unreliable 'rowCount()' in IndexSearchRepository

Oli Bartsch CR +2 V +2 Easy +12 −4 updated 05/02/22, 08:46

Commit message

rowCount() on result sets for SELECT queries are not reliable across
all DBMS, which doctrine/dbal comments in the docblock. See:
https://github.com/doctrine/dbal/blob/110ab13/src/Driver/Result.php#L77

Because of "rowCount()"'s unreliable behaviour for some dbms like
sqlite, this should be avoided to ensure cross dbms support.

'\TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository'
uses 'rowCount()' in 'doSearch()' which fails on sqlite, making it
impossible to get any result in the frontend search.

Doing a count() query as replacement is not possible and needs a
bigger architectural change, which is not feasable as bugfix.
Thus fallback to retrieve the result into an array and counting
the array is used as a intermediate solution to ensure index_search
is working across all supported database systems.

The architectural change will be done in a dedicated patch.

Review

  • Code review CR +2 Done
    • Oli Bartsch +2
  • Verified V +2 Done
    • Oli Bartsch +2
    • core-ci +1 CI

Issues 1

Files 1

Review log 34

  1. Oli Bartsch commented on patch set 1 05/02/22, 07:55

    Cherry Picked from branch main.
  2. core-ci voted on patch set 1 V +1 05/02/22, 08:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26721

  3. Oli Bartsch voted on patch set 1 V +2 CR +2 05/02/22, 08:46

  4. Oli Bartsch merged patch set 2 05/02/22, 08:46