Use TYPO3_DB->exec_SELECTcountRows() to determine the number of rows
In the TYPO Core counting rows is/was implemented as the following:
- get result set for a "COUNT" query, fetch row, free result set (not in all cases)
- get result set for a regular table SELECT, get sql_num_rows, free result set (not in all cases again)
To prevent hanging record sets TYPO3_DB->exec_SELECTcountRows() should be used in future.
(issue imported from #M10099)