Bug #57957

TYPO3\CMS\Dbal\DatabasDatabaseConnection::sql_fetch_assoc() might return null

Added by Tim mie about 8 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Must have
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2014-04-15
Due date:
% Done:

100%

Estimated time:
1.00 h
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
no-brainer
Is Regression:
No
Sprint Focus:

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"

#1

Updated by Jigal van Hemert about 8 years ago

  • Assignee set to Jigal van Hemert
#2

Updated by Gerrit Code Review about 8 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

#3

Updated by Gerrit Code Review about 8 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

#4

Updated by Jigal van Hemert about 8 years ago

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

Updated by Benni Mack almost 4 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF