[ticket/11768] Simplified loop

PHPBB3-11768