fabpot/Silex — comment on commit f15434827c9db74edadacbbe9e09d72aa1f7ffb6
File:  line 0
By stof:

I see an issue here: Creating the dispatcher requires creating the url matcher and so having registered all routes. But service providers that register a listener generally trigger its creation (core ones do this) instead of modifying the definition (which is harder).
Note that this is the same sort of issue than my point about Twig extensions a while ago but a bit simpler as the event dispatcher is always created before registering a service provider (and so retrieving it will work) which was not the case for Twig (as it would require registering the Twig provider first)

This means we need to do a choice between 2 solutions:
- provide a way to add listeners without creating the dispatcher. This is the best solution IMO as it will also allow solving the issue about Twig by using the same way
- document that service providers should always be registered **after** registering the controllers.