When you iterate over an array, it $cellis a copy of the value, not a reference, so changing it will not affect the value in the array.
&, $cell :
foreach ($array as &$cell) {
if ($cell["type"] == "type_list") {
$cell["list"] = $anObject;
error_log(print_r($cell, TRUE), 0);
}
error_log(print_r($array, TRUE), 0);
.
foreach ($array as $i => $cell) {
if ($array[$i]["type"] == "type_list") {
$array[$i]["list"] = $anObject;
error_log(print_r($array[$i], TRUE), 0);
}
error_log(print_r($array, TRUE), 0);