Bug #57957
closedTYPO3\CMS\Dbal\DatabasDatabaseConnection::sql_fetch_assoc() might return null
100%
Description
I found a little bug while using DBAL.
A little background,
In the default situation, TYPO3\CMS\Core\Database\DatabaseConnection::sql_fetch_assoc() returns FALSE if the end of a resultset is reached
When using DBAL, TYPO3\CMS\Dbal\Database\DatabaseConnection::sql_fetch_assoc() returns NULL if the end of a resultset is reached (using native mysqli driver).
In the class TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController (Typo3 6.2.0 LTS) at line 4777 it's expected that sql_fetch_assoc() returns FALSE if the end is reached. When using DBAL this results in an infinite loop.
while (FALSE !== ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result))) {
Suggested solution is to add a check to TYPO3\CMS\Dbal\Database\DatabaseConnection::sql_fetch_assoc() at the end of a function to set the return value to FALSE if $output === null. The same is done in it's parent "Needed for compatibility"
Updated by Gerrit Code Review over 10 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/29502
Updated by Gerrit Code Review over 10 years ago
Patch set 1 for branch TYPO3_6-1 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/29513
Updated by Jigal van Hemert over 10 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 68763faf3bbcaafb5753ae952fe3614ad9aeb10b.