Project

General

Profile

Actions

Bug #57957

closed

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

Added by Tim mie almost 10 years ago. Updated over 5 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"

Actions

Also available in: Atom PDF