Bug #91359
closedforeign_table_where subqueries not working any more
0%
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".
Updated by Lukas Niestroj over 4 years ago
the second regex should be:
/^(.*)[[:space:]]+GROUP[[:space:]]+BY[[:space:]](?=(?!\)).*\(|[^()]*$)+([[:alnum:][:space:],._()"]+)$/is
(I removed the additional regex groups)
Updated by Markus Klein over 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/)
Updated by Ralf Zimmermann over 3 years ago
- Category changed from Form Framework to DataHandler aka TCEmain
Updated by Ralf Zimmermann over 3 years ago
- Category changed from DataHandler aka TCEmain to FormEngine aka TCEforms
Updated by Gerrit Code Review over 3 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
Updated by Gerrit Code Review over 3 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
Updated by Gerrit Code Review over 3 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
Updated by Gerrit Code Review about 3 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
Updated by Christian Kuhn about 3 years ago
- Status changed from Under Review to Rejected