Project

General

Profile

Actions

Bug #91359

closed

foreign_table_where subqueries not working any more

Added by Lukas Niestroj almost 4 years ago. Updated over 2 years ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2020-05-11
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

Description

Before TYPO3 9 i had configs like the following:

'foreign_table_where' => 'pages.uid IN (SELECT pid FROM fe_users GROUP BY fe_users.pid)'

with the current Version 9.5.16 it is not possible anymore.

As a quick fix I have to add another GROUP BY: pages.uid IN (SELECT pid FROM fe_users GROUP BY fe_users.pid) GROUP BY uid

The issue is in typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php:1192. The regex just takes the first occurence of a "GROUP BY" statement.

I already have a fix for the regular expression.

before:

/^(.*)[[:space:]]+GROUP[[:space:]]+BY[[:space:]]+([[:alnum:][:space:],._()"]+)$/is

after:

/^(.*)[[:space:]]+(GROUP[[:space:]]+BY[[:space:]])(?=(((?!\)).)*\()|[^()]*$)+([[:alnum:][:space:],._()"]+)$/is

I added a positive lookahead after a "GROUP BY" is found to check whether it is between "(.*)".

The same "issue" applies for useage of "LIMIT" and "ORDER BY".

Actions #1

Updated by Lukas Niestroj almost 4 years ago

the second regex should be:

/^(.*)[[:space:]]+GROUP[[:space:]]+BY[[:space:]](?=(?!\)).*\(|[^()]*$)+([[:alnum:][:space:],._()"]+)$/is

(I removed the additional regex groups)

Actions #2

Updated by Markus Klein almost 4 years ago

Thanks Lukas for your change suggestion.
Would you mind pushing your change request to our review system?
(https://docs.typo3.org/m/typo3/guide-contributionworkflow/master/en-us/)

Actions #3

Updated by Ralf Zimmermann over 2 years ago

  • Category changed from Form Framework to DataHandler aka TCEmain
Actions #4

Updated by Ralf Zimmermann over 2 years ago

  • Category changed from DataHandler aka TCEmain to FormEngine aka TCEforms
Actions #5

Updated by Gerrit Code Review over 2 years 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/c/Packages/TYPO3.CMS/+/70293

Actions #6

Updated by Gerrit Code Review over 2 years 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/c/Packages/TYPO3.CMS/+/70293

Actions #7

Updated by Gerrit Code Review over 2 years 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/c/Packages/TYPO3.CMS/+/70293

Actions #8

Updated by Gerrit Code Review over 2 years 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/c/Packages/TYPO3.CMS/+/70293

Actions #9

Updated by Christian Kuhn over 2 years ago

  • Status changed from Under Review to Rejected
Actions

Also available in: Atom PDF