Project

General

Profile

Actions

Bug #79473

open

Typo3DbQueryParser fails since Doctrine by comparing date fields

Added by Georg Ringer about 7 years ago. Updated about 2 years ago.

Status:
New
Priority:
Must have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2017-01-26
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Since the move to native Doctrine querybuilding in extbase with #77379, the comparing using calls like greaterThan,lessThan,... fail if a date field should be compared.

The error can easily be spotted by taking a look into the method parseDynamicOperand Github

case QueryInterface::OPERATOR_LESS_THAN_OR_EQUAL_TO:
                $value = $this->queryBuilder->createNamedParameter($this->dataMapper->getPlainValue($value), \PDO::PARAM_INT);
                $expr = $exprBuilder->comparison($fieldName, $exprBuilder::LTE, $value);
                break;

Using PDO::PARAM_INT is wrong if in the DB an actual date or datetime type is used.


Related issues 8 (1 open7 closed)

Related to TYPO3 Core - Bug #77379: Doctrine: Migrate extbase Typo3DbBackend and Typo3DbQueryParserClosedMarkus Hölzle2016-08-03

Actions
Related to TYPO3 Core - Bug #81019: Query Builder: Error when ordering by DateTime fieldsClosed2017-04-26

Actions
Related to TYPO3 Core - Bug #81056: Query Builder fails on greater / less comparisons on string fieldsClosed2017-04-28

Actions
Related to TYPO3 Core - Bug #63482: Query constraint on a DateTime field with a DateTime argument should trigger date formatNew2014-12-01

Actions
Related to TYPO3 Core - Epic #90106: [Extbase] Priority BugfixesClosed2018-03-07

Actions
Has duplicate TYPO3 Core - Bug #80978: TYPO3 Query Builder: not able to compare floating point numbers (except equal)!Closed2017-04-24

Actions
Has duplicate TYPO3 Core - Bug #81487: Quoting error for date field when building query in extbase repositoryClosed2017-06-06

Actions
Has duplicate TYPO3 Core - Bug #81719: DateTime comparisons not possible in 8.7Closed2017-06-27

Actions
Actions #1

Updated by Josef Glatz about 7 years ago

  • Description updated (diff)
Actions #2

Updated by Markus Klein about 7 years ago

  • Target version set to 8 LTS
  • Sprint Focus set to Stabilization Sprint
Actions #3

Updated by Marc Neuhaus about 7 years ago

  • Assignee set to Marc Neuhaus
Actions #4

Updated by Frank Nägler almost 7 years ago

did extbase support date and datetime fields? imho only int (unix timestamp) is supported, correct me if I am wrong.

Actions #5

Updated by Jigal van Hemert almost 7 years ago

\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::getPlainValue() already takes care of \DateTime objects and the date / datetime database fields. There seems to be no reason to use \PDO::PARAM_INT in \TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::parseDynamicOperand() for certain operators and \PDO::PARAM_STR (the default) for other operators.

Actions #6

Updated by Christian Kuhn almost 7 years ago

  • Target version deleted (8 LTS)
  • Sprint Focus deleted (Stabilization Sprint)
Actions #7

Updated by Mona Muzaffar almost 7 years ago

  • Related to Epic #80852: Datetime handling in backend added
Actions #8

Updated by Georg Ringer almost 7 years ago

  • Related to deleted (Epic #80852: Datetime handling in backend)
Actions #9

Updated by Georg Ringer almost 7 years ago

  • Has duplicate Bug #80978: TYPO3 Query Builder: not able to compare floating point numbers (except equal)! added
Actions #10

Updated by Georg Ringer almost 7 years ago

  • Related to Bug #81019: Query Builder: Error when ordering by DateTime fields added
Actions #11

Updated by Riccardo De Contardi almost 7 years ago

I write here the description of #80978 to keep track of it:

it takes me hours to find out that all comparisons numbers parsed to Integer!!!
Please also take care of floating point numbers when you convert the TYPO3 QueryBuilder to Doctrine QueryBilder in Typo3DbQueryParser class.

Bug-Snippet of Typo3DbQueryParser.php:

           case QueryInterface::OPERATOR_LESS_THAN:
                $value = $this->queryBuilder->createNamedParameter($this->dataMapper->getPlainValue($value), \PDO::PARAM_INT);
                $expr = $exprBuilder->comparison($fieldName, $exprBuilder::LT, $value);
                break;
            case QueryInterface::OPERATOR_LESS_THAN_OR_EQUAL_TO:
                $value = $this->queryBuilder->createNamedParameter($this->dataMapper->getPlainValue($value), \PDO::PARAM_INT);
                $expr = $exprBuilder->comparison($fieldName, $exprBuilder::LTE, $value);
                break;
            case QueryInterface::OPERATOR_GREATER_THAN:
                $value = $this->queryBuilder->createNamedParameter($this->dataMapper->getPlainValue($value), \PDO::PARAM_INT);
                $expr = $exprBuilder->comparison($fieldName, $exprBuilder::GT, $value);
                break;
            case QueryInterface::OPERATOR_GREATER_THAN_OR_EQUAL_TO:
                $value = $this->queryBuilder->createNamedParameter($this->dataMapper->getPlainValue($value), \PDO::PARAM_INT);
                $expr = $exprBuilder->comparison($fieldName, $exprBuilder::GTE, $value);
                break;

Actions #12

Updated by Christian Toffolo almost 7 years ago

I add myself to all those that wasted hours because of this bug.

I'm not a developer, but isn't this as simple to fix as changing "\PDO::PARAM_INT" with "\PDO::PARAM_STR"?

@Riccardo: another related one is https://forge.typo3.org/issues/81056

Actions #13

Updated by Gerrit Code Review almost 7 years ago

  • Status changed from Accepted 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/52802

Actions #14

Updated by Riccardo De Contardi almost 7 years ago

  • Related to Bug #81056: Query Builder fails on greater / less comparisons on string fields added
Actions #15

Updated by Gerrit Code Review almost 7 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/52802

Actions #16

Updated by Gerrit Code Review almost 7 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/52802

Actions #17

Updated by Gerrit Code Review almost 7 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/52802

Actions #18

Updated by Gerrit Code Review almost 7 years ago

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

Actions #19

Updated by Gerrit Code Review almost 7 years ago

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

Actions #20

Updated by Gerrit Code Review almost 7 years ago

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

Actions #21

Updated by Gerrit Code Review almost 7 years ago

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

Actions #22

Updated by Gerrit Code Review almost 7 years ago

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

Actions #23

Updated by Gerrit Code Review almost 7 years ago

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

Actions #24

Updated by Morton Jonuschat almost 7 years ago

  • Has duplicate Bug #81487: Quoting error for date field when building query in extbase repository added
Actions #25

Updated by Gerrit Code Review almost 7 years ago

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

Actions #26

Updated by Gerrit Code Review almost 7 years ago

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

Actions #27

Updated by Gerrit Code Review almost 7 years ago

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

Actions #28

Updated by Gerrit Code Review almost 7 years 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/53244

Actions #29

Updated by Christian Toffolo almost 7 years ago

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

Updated by Riccardo De Contardi over 6 years ago

  • Related to Bug #81719: DateTime comparisons not possible in 8.7 added
Actions #31

Updated by Georg Ringer about 6 years ago

  • Related to Bug #63482: Query constraint on a DateTime field with a DateTime argument should trigger date format added
Actions #32

Updated by Gerrit Code Review about 6 years ago

  • Status changed from Resolved to Under Review

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

Actions #33

Updated by Gerrit Code Review about 6 years ago

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

Actions #34

Updated by Christian Kuhn over 5 years ago

  • Status changed from Under Review to New
  • Assignee deleted (Marc Neuhaus)
Actions #35

Updated by Alexander Schnitzler about 4 years ago

  • Status changed from New to Accepted
  • Parent task set to #90106
Actions #36

Updated by Gerrit Code Review almost 4 years ago

  • Status changed from Accepted to Under Review

Patch set 7 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/+/51817

Actions #37

Updated by Gerrit Code Review over 3 years ago

Patch set 8 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/+/51817

Actions #38

Updated by Oliver Hader over 3 years ago

  • Is Regression changed from Yes to No
Actions #39

Updated by Christian Kuhn over 2 years ago

  • Status changed from Under Review to New
Actions #40

Updated by Christian Kuhn about 2 years ago

  • Parent task deleted (#90106)
Actions #41

Updated by Christian Kuhn about 2 years ago

  • Related to Epic #90106: [Extbase] Priority Bugfixes added
Actions #42

Updated by Markus Klein 9 months ago

  • Related to deleted (Bug #81719: DateTime comparisons not possible in 8.7)
Actions #43

Updated by Markus Klein 9 months ago

  • Has duplicate Bug #81719: DateTime comparisons not possible in 8.7 added
Actions

Also available in: Atom PDF