[TYPO3-core] RFC #14488: prioriCalc no longer working correctly due to changes in rev 7592

Franz Koch typo3.RemoveForMessage at elements-net.de
Thu May 27 08:52:01 CEST 2010


Hey Xavier,

> Many calls of while(list()) _at the beginning of functions_ with
> provided arguments (and without reset() first) were simply replaced by
> foreach.
>
> However following code shows a possible side effect:
>
> <?php
>
> function foo($arr) {
> while(list(,$v) = each($arr)) {
> echo $v . "\n";
> }
> }
>
> $a = array(1,2,3,4);
> list(,$value) = each($a);
>
> foo($a);
>
> ?>
>
> which prints 2 3 4 instead of 1 2 3 4 which we would get with current
> state using foreach.

I think the missing "reset($arr)" has nothing to say in such cases - it 
simply might have been forgotten, although we can't be sure actually. I 
think it's good that the while(list()) stuff got replaced, as the code 
is also better to read not having to track down possible code that's 
changing the array pointers.

-- 
kind regards,
Franz Koch


More information about the TYPO3-team-core mailing list