[TYPO3-core] RFC: Bugfix show_item.php

Ingmar Schlecht ingmar at typo3.org
Sat Mar 25 23:07:59 CET 2006


Hi Bernhard,

Bernhard Kraft wrote:
> Description:
> When you click the little "i" next to the edit-pencil and you open a
> record which hasn't any references
> set you get an php-error complaining about the argument to foreach no
> being an array ...

That is strange, because $rows should always be an array, if no
references are found it should just be an empty array.

The only condition in which t3lib_db::exec_SELECTgetRows() does *not*
return an array is if there was a sql error. If that is the case, this
should be fixed instead of moving the foreach().

Could you please debug why $rows was not an array in your case?

> Solution:
> Move the foreach loop into the if (count($rows)) condition.

-1 as count($rows) only works properly on a arrays, too.

cheers,
Ingmar



More information about the TYPO3-team-core mailing list