Project

General

Profile

Actions

Bug #43114

closed

sanitizeSelectPart - select CONTENT using DISTINCT

Added by GAYA La Nouvelle Agence about 12 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
TypoScript
Target version:
-
Start date:
2012-11-19
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
5.3
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

Description

Hi,

I've encounter a problem while upgrading to 4.5.22. The sanitizeSelectPart() method was introduced (backported from 4.6 I think) and poses a new problem while using DISTINCT directive. Ex :

test = CONTENT
test {
table = tx_test
select.selectFields = DISTINCT as test
}

The sanitizeSelectPart method will add uid and pid in select clause and so... it won't do what we expect
I saw that some exception was already introduced (count|max|min|avg|sum). Adding distinct will solved the problem.

I don't understand why these "necessaryFields" (uid, pid) were introduced cause in many cases they are not necessary, but this method doesn't smell good and adding some exceptions like it was already done smell worse...


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #34152: stdWrap function numRows() fails in 4.6 due to wrong SELECT clauseClosedErnesto Baschny2012-02-21

Actions
Actions #1

Updated by GAYA La Nouvelle Agence about 12 years ago

small correction in the selectfield example :

test = CONTENT
test {
table = tx_test
select.selectFields = DISTINCT(my_field) as test
}
Actions #2

Updated by Michael Stucki about 12 years ago

  • Assignee deleted (Michael Stucki)

Please don't assign tickets without asking back!

Actions #3

Updated by GAYA La Nouvelle Agence over 11 years ago

  • Target version changed from 4.5.23 to 4.5.24

A patch could simply be done by adding distinct exception :

typo3_src-4.7.7/typo3/sysext/cms/tslib/class.tslib_content.php
7852c7852
< && !preg_match('/(count|max|min|avg|sum)\([^\)]+\)/i', $selectPart)) {
---

&& !preg_match('/(count|max|min|avg|sum|distinct)\([^\)]+\)/i', $selectPart)) {

8100c8100

Actions #4

Updated by GAYA La Nouvelle Agence over 11 years ago

  • Target version changed from 4.5.24 to 4.5.26
Actions #5

Updated by Mathias Schreiber almost 10 years ago

  • Target version changed from 4.5.26 to 7.2 (Frontend)
  • Is Regression set to No
Actions #6

Updated by Gerrit Code Review over 9 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 http://review.typo3.org/38372

Actions #7

Updated by Benni Mack over 9 years ago

  • Target version changed from 7.2 (Frontend) to 7.4 (Backend)
Actions #8

Updated by Susanne Moog over 9 years ago

  • Target version changed from 7.4 (Backend) to 7.5
Actions #9

Updated by Andreas Kienast about 9 years ago

  • Status changed from Under Review to New
Actions #10

Updated by Benni Mack about 9 years ago

  • Status changed from New to Under Review
  • Target version deleted (7.5)
Actions #11

Updated by Daniel Goerz almost 9 years ago

  • Status changed from Under Review to New

Patch was abandoned.

Actions #12

Updated by Gerrit Code Review over 4 years ago

  • Status changed from New to Under Review

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/+/38372

Actions #13

Updated by Gerrit Code Review over 4 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/+/38372

Actions #14

Updated by Gerrit Code Review over 4 years ago

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

Actions #15

Updated by Susanne Moog over 4 years ago

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

Updated by Benni Mack over 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF