Bug #82159

GROUP BY support broken in TCA foreign_table_where

Added by Frenck Lutke 8 months ago. Updated 6 months ago.

Status:
Resolved
Priority:
Must have
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2017-08-22
Due date:
% Done:

100%

TYPO3 Version:
8
PHP Version:
7.1
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

\TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider->buildForeignTableQueryBuilder()

calls
\TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider->processForeignTableClause()

which returns an array with the processed query parts from the foreign_table_where.

The GROUPBY part is an array, since the function explicitly explodes the GROUP BY fields.

This is then passed on to

if (!empty($foreignTableClauseArray['GROUPBY'])) {
    $queryBuilder->groupBy($foreignTableClauseArray['GROUPBY']);
}

where it all goes wrong. This method uses the variadic operator "..." for $groupby, which contains remaining (in this case all) arguments as an array. So now we have a multi-dimensional array, where the ensuing code expects a flat array. When it attempts to quote identifiers, it ends up passing an array to strpos(), consistently causing a PHP error.

The end-result is that any attempt to create or edit a TCA record that contains such a foreign_table_where on one of its columns or via an inline record configuration, results in an uncaught TYPO3 Exception.

Associated revisions

Revision f3e7a034 (diff)
Added by Wolfgang Klinger 6 months ago

[BUGFIX] Fix foreign_table_where GROUP BY handling

Unpack the array elements before passing them on

Resolves: #82159
Releases: master, 8.7
Change-Id: I6a094927f595d42fc15bb96a9dbc1d313a7808b0
Reviewed-on: https://review.typo3.org/54473
Tested-by: TYPO3com <>
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>
Reviewed-by: Wouter Wolters <>
Tested-by: Wouter Wolters <>

Revision 0b7c8667 (diff)
Added by Wolfgang Klinger 6 months ago

[BUGFIX] Fix foreign_table_where GROUP BY handling

Unpack the array elements before passing them on

Resolves: #82159
Releases: master, 8.7
Change-Id: I6a094927f595d42fc15bb96a9dbc1d313a7808b0
Reviewed-on: https://review.typo3.org/54505
Tested-by: TYPO3com <>
Reviewed-by: Wouter Wolters <>
Tested-by: Wouter Wolters <>

History

#1 Updated by Wouter Wolters 8 months ago

  • Description updated (diff)

#2 Updated by Gerrit Code Review 6 months ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54473

#3 Updated by Wolfgang Klinger 6 months ago

  • Category set to Database API (Doctrine DBAL)
  • Assignee set to Wolfgang Klinger

#4 Updated by Gerrit Code Review 6 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54473

#5 Updated by Gerrit Code Review 6 months ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54473

#6 Updated by Gerrit Code Review 6 months ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54473

#7 Updated by Gerrit Code Review 6 months ago

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54505

#8 Updated by Wolfgang Klinger 6 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF