utils
utils copied to clipboard
iteration over ArrayHash with reference
Hi @dg, this hotfix breaks iteration over ArrayHash with reference, which is quite unpredictable until one looks into the code..
$hash = \Nette\Utils\ArrayHash::from([1]);
foreach($hash as $k => & $v) {
$v = 2;
}
dump($hash);
result
Nette\Utils\ArrayHash
0: 1
I don't know if that can be fixed somehow, but at least it could be mentioned in doc for newcomers
I can't think of a way to fix it, but feel free to add it to the documentation.
Ping @Ciki