Bug #95921
closedArray to string conversion error in ContentObjectRenderer (PHP8)
100%
Description
With the following configuration of a DatabaseQueryProcessor:
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor 10 { table = tx_myext_table where = parent=###pages_uid### and parenttable="pages" orderBy = sorting markers { pages_uid.field = uid } includeRecordsWithoutDefaultTranslation = 1 as = records }
The following error occurs:
PHP Warning: Array to string conversion in /var/www/html/public/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php line 6098
The problem here is that the orderBy part stored as an array:
[ [ 'sorting', null ] ]
and used as $queryPartValue:
$queryPartValue = str_replace('###' . $marker . '###', $markerValue, $queryPartValue);
Updated by Torben Hansen almost 3 years ago
The "ugly hack" mentioned in the code seems to be non-functional. I debugged the code of the for-each loop and there also CompositeExpression
objects are passed as argument to str_replace
resulting in the objects being typecasted to strings. This results in useless $queryParts
variable, since certain parts of the expression now are removed due to the typecast.
Best would be to check, if we either pass strings or one-dimensional arrays to str_replace, but actually, I'm pretty sure, that the whole for-each loop for the $queryParts
variable is not required at all. To me it seems line 6121 to 6124 can be removed, since the $queryParts
variable is not used afterwards.
Updated by Gerrit Code Review almost 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/+/72272
Updated by Gerrit Code Review almost 3 years ago
Patch set 1 for branch 11.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/+/72260
Updated by Torben Hansen almost 3 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset bdf9728aacd8c53477418fa922712e8f597951c2.