Bug #67204

Calling DatabaseConnection::exec_SELECTgetRows() with an invalid $uidIndexField returns only a single row

Added by Markus Klein about 4 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Database API (Doctrine DBAL)
Target version:
Start date:
2015-05-29
Due date:
% Done:

100%

TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

Description

If one accidentally calls DatabaseConnection::exec_SELECTgetRows() with an invalid $uidIndexField, the method only returns a single record.

The reason is that the existence of the specified field is not verified. If the field is not set, the code

$output[$tempRow[$uidIndexField]] = $tempRow;

results in
$output[0] = $tempRow;

which simply overrides the first entry of the array. This happens for every record, hence finally only the last record of the query result is returned.

The method should check the $uidIndexField really exists and should throw an exception otherwise, in order to inform the developer of the mistake.

Associated revisions

Revision 7b0cd353 (diff)
Added by Markus Klein about 4 years ago

[!!!][BUGFIX] Check for existing index column in exec_SELECTgetRows()

In case the specified $uidIndexField does not exist in the result,
throw an exception.

Do not call debug() again since it has already been called in
exec_SELECTquery().

Resolves: #67204
Releases: master
Change-Id: I3b0a49a24da50b8ee5390f0619bf78e2e3fe772d
Reviewed-on: http://review.typo3.org/39807
Reviewed-by: Andreas Fernandez <>
Tested-by: Andreas Fernandez <>
Reviewed-by: Frank Nägler <>
Tested-by: Frank Nägler <>

History

#1 Updated by Gerrit Code Review about 4 years ago

  • Status changed from Accepted 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 http://review.typo3.org/39807

#2 Updated by Gerrit Code Review about 4 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39807

#3 Updated by Gerrit Code Review about 4 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39807

#4 Updated by Gerrit Code Review about 4 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39807

#5 Updated by Gerrit Code Review about 4 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39807

#6 Updated by Gerrit Code Review about 4 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39807

#7 Updated by Markus Klein about 4 years ago

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

#8 Updated by Riccardo De Contardi almost 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF