It works under normal conditions, but not in 404 pages. Check out the SF doc here: http://symfony.com/doc/current/cookbook/controller/error_pages.html (second gray box).