foreach and references
Apparently this is not a bug and it's documented:
$array = array('foo', 'bar');
foreach ($array as &$foo);
foreach ($array as $foo);
Remember what http://www.php.net/manual/en/control-structures.foreach.php say about this:
Reference of a $value and the last array element remain even after the foreach loop. It is recommended to destroy it by unset().