[ticket/12653] Caches the listeners and register them as service listener

https://tracker.phpbb.com/browse/PHPBB3-12653

PHPBB3-12653
if the array has only 2 elements, we could use `$listener[0] => $listener[1]` instead?