Bug #81019
closedQuery Builder: Error when ordering by DateTime fields
100%
Description
Hello
I have an Extbase model with a DateTime "crdate" field, defined like this in the model.
/**
* crdate
*
* @var \DateTime
*/
protected $crdate;
In it's repo I'm just trying to fetch all its models in a custom function, all this function does is return all the objects and sort them by the crdate field:
public function getLatestJobs($limit = 0) {
$query = $this->createQuery();
$query->getQuerySettings()->setRespectStoragePage(FALSE);
if ($limit) {
$query->setLimit($limit);
}
$query->setOrderings(array('crdate' => QueryInterface::ORDER_DESCENDING));
return $query->execute();
}
This generates a TYPO3 exception in the frontend, as the compiled code does an htmlspecialchars call when fetching the date.
This is the error I get: "#1476107295: PHP Warning: htmlspecialchars() expects parameter 1 to be string, object given", and the compiled code which generates the error looks like this:
$arguments98 = array();
$arguments98['date'] = NULL;
$arguments98['format'] = '';
$arguments98['base'] = NULL;
$arguments98['format'] = 'Y-m-d';
$array100 = array (
);$arguments98['date'] = htmlspecialchars($renderingContext->getVariableProvider()->getByPath('job.crdate', $array100), ENT_QUOTES);
I'm assuming that $renderingContext->getVariableProvider()->getByPath('job.crdate', $array100) returns a DateTime object while htmlspecialchars deals only with strings, obviously.
Updated by Georg Ringer over 7 years ago
- Related to Bug #79473: Typo3DbQueryParser fails since Doctrine by comparing date fields added
Updated by Benni Mack over 7 years ago
- Target version changed from 8 LTS to next-patchlevel
Updated by Gerrit Code Review over 7 years ago
- Status changed from New to Under Review
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 over 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 over 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 Ian Solo over 7 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 0bd1746384980d9f6f7387d8638d280443ee843b.