[TYPO3-mvc] Strange usage of array_fill_keys()

Stefan Neufeind typo3.neufeind at speedpartner.de
Sat Apr 13 15:02:07 CEST 2013


On 04/13/2013 02:28 PM, Jochen Rau wrote:
> 
>> 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?
> 
> I think we can safely delete these lines. They are non-functional.

Thanks for the quick confirmation. Filed an issue and pushed a patch:
http://forge.typo3.org/issues/47185
https://review.typo3.org/19914

> Also, the argument $source is not used within the scope of the
> function. Changing the signature of the function might break
> functions of extending classes, though.

We might want to handle that separately in some way with deprecation
etc. But that needs a closer look.


Kind regards,
 Stefan


More information about the TYPO3-project-typo3v4mvc mailing list