Bug #79473
openTypo3DbQueryParser fails since Doctrine by comparing date fields
100%
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.
Updated by Markus Klein over 7 years ago
- Target version set to 8 LTS
- Sprint Focus set to Stabilization Sprint
Updated by Frank Nägler over 7 years ago
did extbase support date and datetime fields? imho only int (unix timestamp) is supported, correct me if I am wrong.
Updated by Jigal van Hemert over 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.
Updated by Christian Kuhn over 7 years ago
- Target version deleted (
8 LTS) - Sprint Focus deleted (
Stabilization Sprint)
Updated by Mona Muzaffar over 7 years ago
- Related to Epic #80852: Datetime handling in backend added
Updated by Georg Ringer over 7 years ago
- Related to deleted (Epic #80852: Datetime handling in backend)
Updated by Georg Ringer over 7 years ago
- Has duplicate Bug #80978: TYPO3 Query Builder: not able to compare floating point numbers (except equal)! added
Updated by Georg Ringer over 7 years ago
- Related to Bug #81019: Query Builder: Error when ordering by DateTime fields added
Updated by Riccardo De Contardi over 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;
Updated by Christian Toffolo over 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
Updated by Gerrit Code Review over 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
Updated by Riccardo De Contardi over 7 years ago
- Related to Bug #81056: Query Builder fails on greater / less comparisons on string fields added
Updated by Gerrit Code Review over 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
Updated by Gerrit Code Review over 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
Updated by Gerrit Code Review over 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
Updated by Gerrit Code Review over 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
Updated by Gerrit Code Review over 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
Updated by Gerrit Code Review over 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
Updated by Gerrit Code Review over 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
Updated by Gerrit Code Review over 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
Updated by Gerrit Code Review about 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
Updated by Morton Jonuschat about 7 years ago
- Has duplicate Bug #81487: Quoting error for date field when building query in extbase repository added
Updated by Gerrit Code Review about 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
Updated by Gerrit Code Review about 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
Updated by Gerrit Code Review about 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
Updated by Gerrit Code Review about 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
Updated by Christian Toffolo about 7 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 0bd1746384980d9f6f7387d8638d280443ee843b.
Updated by Riccardo De Contardi about 7 years ago
- Related to Bug #81719: DateTime comparisons not possible in 8.7 added
Updated by Georg Ringer over 6 years ago
- Related to Bug #63482: Query constraint on a DateTime field with a DateTime argument should trigger date format added
Updated by Gerrit Code Review over 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
Updated by Gerrit Code Review over 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
Updated by Christian Kuhn almost 6 years ago
- Status changed from Under Review to New
- Assignee deleted (
Marc Neuhaus)
Updated by Alexander Schnitzler over 4 years ago
- Status changed from New to Accepted
- Parent task set to #90106
Updated by Gerrit Code Review about 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
Updated by Gerrit Code Review almost 4 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
Updated by Christian Kuhn almost 3 years ago
- Status changed from Under Review to New
Updated by Christian Kuhn over 2 years ago
- Related to Epic #90106: [Extbase] Priority Bugfixes added
Updated by Markus Klein about 1 year ago
- Related to deleted (Bug #81719: DateTime comparisons not possible in 8.7)
Updated by Markus Klein about 1 year ago
- Has duplicate Bug #81719: DateTime comparisons not possible in 8.7 added