2013-12-12 83 views
1

我最近更新的Symfony從2.1到2.2,現在我得到錯誤:錯誤「類‘Twig_SimpleFunction’找不到」升級後的Symfony 2.2

錯誤:類「Twig_SimpleFunction」在供應商/ symfony中未找到/ symfony中/ src目錄/ Symfony的/包/ SecurityBundle /嫩枝/分機/ LogoutUrlExtension.php線41

我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說: 「作爲嫩枝1.x中,請使用Twig_SimpleFunction」。我有1.11,所以我不明白我做錯了什麼。

回答

1

發現了它。正如我懷疑的那樣,問題出在無效的依賴關係上。我下載Symfony2.2.11並相應地改變了我的composer.json(注意沒有提及了枝杈,並改變了一些symfony中/ *和SENSIO/*依賴):

"require": { 
    "php": ">=5.3.3", 
    "symfony/symfony": "2.2.*", 
    "twig/extensions": "1.0.*", 
    "noetix/easy-csv": "dev-master", 
    "symfony/assetic-bundle": "2.1.*", 
    "symfony/swiftmailer-bundle": "2.2.*", 
    "symfony/monolog-bundle": "2.2.*", 
    "sensio/distribution-bundle": "2.2.*", 
    "sensio/framework-extra-bundle": "2.2.*", 
    "sensio/generator-bundle": "2.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" 
}, 

此安裝樹枝1.15和一切正常。 The manual page有錯誤 - Twig_SimpleFunction出現在1.11和< = 1.15之間,而不是1.x.

+0

你可以接受這個答案,使這個問題看起來像解決。 – martias

0

樹枝擴展類不是命名空間。你有沒有檢查你沒有改變?

在你擴展類,你應該使用\Twig_SimpleFunction,不只是Twig_SimpleFunction

+0

感謝您的回答,但問題是Twig_SimpleFunction根本不存在,儘管根據手冊(我上面提到的鏈接)它應該存在。 – JohnSmith

相關問題