Fix for registering functions for Twig above 1.12

https://github.com/fabpot/Twig/issues/962