[ticket/11701] Loop variables are not passed correctly to events

http://tracker.phpbb.com/browse/PHPBB3-11701