I recently updated Symfony from 2.1 to 2.2 and now I'm getting error:
Error: Class 'Twig_SimpleFunction' not found in vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Twig/Extension/LogoutUrlExtension.php line 41
My composer.json:
...
"require": {
"php": ">=5.4",
"symfony/symfony": "2.2.*",
"twig/twig": "1.11.x",
"twig/extensions": "1.0.x-dev",
"noetix/easy-csv": "dev-master",
"symfony/assetic-bundle": "2.*",
"symfony/swiftmailer-bundle": "2.*",
"symfony/monolog-bundle": "2.*",
"sensio/distribution-bundle": "2.*",
"sensio/framework-extra-bundle": "2.*",
"sensio/generator-bundle": "2.*",
"jms/security-extra-bundle": "1.4.*",
"jms/di-extra-bundle": "1.3.*",
"jms/serializer": "0.12.*",
"jms/serializer-bundle" : "0.12.*@dev",
"jms/metadata" : "1.3.*",
"friendsofsymfony/user-bundle": "patch-1-dev",
"friendsofsymfony/jsrouting-bundle": "1.2.*",
"propel/propel1": ">=1.6.7",
"propel/propel-bundle": "1.2.x-dev",
"willdurand/propel-typehintable-behavior": "dev-master",
"pagerfanta/pagerfanta": "1.0.x-dev",
"white-october/pagerfanta-bundle": "dev-master",
"knplabs/knp-menu-bundle": "dev-master",
"knplabs/knp-menu": "2.0.x-dev",
"exercise/elastica-bundle": "dev-master",
"gregwar/captcha-bundle": "dev-master",
"nelmio/api-doc-bundle": "2.1.*",
"fr3d/ldap-bundle": "2.0.*@dev",
"conjecto/easyrdf-bundle": "dev-master"
},
...
Twig deprecated features page says: "As of Twig 1.x, use Twig_SimpleFunction". I have 1.11, so I don't get it what I'm doing wrong.
Found it. The problem was in invalid dependencies as I suspected. I downloaded Symfony2.2.11 and changed my composer.json accordingly (notice no reference to twig anymore, and changed some symfony/* and sensio/* dependencies):
This installed twig 1.15 and everything works. The manual page has error - Twig_SimpleFunction appears somewhere between >1.11 and <=1.15, not in 1.x.
Twig extension classes are not namespaced. Have you checked that you haven't changed that?
Within you extension class you should use
\Twig_SimpleFunction
, not justTwig_SimpleFunction