[TYPO3-mvc] Strange usage of array_fill_keys()
Stefan Neufeind
typo3.neufeind at speedpartner.de
Sat Apr 13 13:15:25 CEST 2013
Hi,
during review of a patch I stumbled across something I couldn't make
sense of. And the comment seems to indicate somebody else had the same
problem :-)
in Typo3DbBackend.php, getRowsFromResult() is just:
$rows = array();
while ($row = $this->databaseHandle->sql_fetch_assoc($result)) {
if (is_array($row)) {
// TODO Check if this is necessary, maybe the last line is enough
$arrayKeys = range(0, count($row));
array_fill_keys($arrayKeys, $row);
$rows[] = $row;
}
}
return $rows;
@Jochen/Sebastian: Git says you were somehow involved in those two
lines. What is actually their background/use-case? If they are needed,
could we come up with a testcase for one special problem you adressed
this way?
In case it makes sense in some way (which I'm not really sure yet) the
arrayKeys-array is one element too long. But practically that seems to
be of no importance.
Kind regards,
Stefan
More information about the TYPO3-project-typo3v4mvc
mailing list