Symfony2 crash after composer update

ぃ、小莉子 提交于 2019-12-22 08:12:46

问题


I encounter a problem since I have update my vendors on Symfony2 installation.

This is content of my composer.json :

{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
    "psr-0": { "": "src/" }
},
"require": {
    "php": ">=5.4",
    "symfony/symfony": ">=2.4",
    "doctrine/orm": "~2.2,>=2.2.3",
    "doctrine/doctrine-bundle": ">=1.2",
    "twig/extensions": ">=1.0",
    "symfony/assetic-bundle": ">=2.3",
    "symfony/swiftmailer-bundle": ">=2.3",
    "symfony/monolog-bundle": ">=2.4",
    "sensio/distribution-bundle": ">=2.3",
    "sensio/framework-extra-bundle": ">=3.0",
    "sensio/generator-bundle": ">=2.3",
    "incenteev/composer-parameter-handler": "~2.0",
    "white-october/pagerfanta-bundle": "dev-master",
    "friendsofsymfony/rest-bundle": "1.3.*",
    "friendsofsymfony/comment-bundle": "2.0.*@dev",
    "friendsofsymfony/message-bundle": "1.2.*@dev",
    "friendsofsymfony/user-bundle": "~2.0@dev",
    "nelmio/api-doc-bundle": "@stable",
     "ornicar/akismet-bundle": "dev-master",
    "friendsofsymfony/jsrouting-bundle": "2.0.*@dev",
    "appventus/alertify-bundle": "dev-master",
  "friendsofsymfony/oauth-server-bundle": "dev-master",
  "willdurand/propel-typehintable-behavior": "*",
  "hwi/oauth-bundle": "0.4.*@dev",
  "nomaya/social-bundle": "dev-master"

}
}

After a php composer.phar update, when I try /app.php, I have following errors :

Deprecated: The Symfony\Component\Security\Core\SecurityContextInterface interface is deprecated since version 2.6 and will be removed in 3.0. in /var/www/html/xxx/app/cache/prod/classes.php on line 3035
Deprecated: The Symfony\Component\Security\Core\SecurityContext class is deprecated since version 2.6 and will be removed in 3.0. Use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage or Symfony\Component\Security\Core\Authorization\AuthorizationChecker instead. in /var/www/html/xxx/app/cache/prod/classes.php on line 3047
Fatal error: Uncaught exception 'Symfony\Component\Debug\Exception\ContextErrorException' with message 'Catchable 
Fatal Error: Argument 1 passed to Symfony\Component\Routing\Router::Symfony\Component\Routing\{closure}() must be an instance of Symfony\Component\Config\ConfigCacheInterface, instance of Symfony\Component\Config\ConfigCache given' in /var/www/html/xxx/app/cache/prod/classes.php:1302 

Stack trace: 
#0 /var/www/html/xxx/app/cache/prod/classes.php(1302): Symfony\Component\Debug\ErrorHandler->handleError(4096, 'Argument 1 pass...', '/var/www/html/p...', 1302, Array) 
#1 [internal function]: Symfony\Component\Routing\Router->Symfony\Component\Routing\{closure}(Object(Symfony\Component\Config\ConfigCache)) 
#2 /var/www/html/xxx/vendor/symfony/symfony/src/Symfony/Component/Config/ConfigCacheFactory.php(46): call_user_func(Object(Closure), Object(Symfony\Component\Config\ConfigCache)) 
#3 /var/www/html/xxx/app/cache/prod/classes.php(1313): Symfony\Component\Config\ConfigCacheFactory->cache('/var/ww in /var/www/html/xxx/app/cache/prod/classes.php on line 5261

and when I go to /app_dev.php I have this one :

Whoops, looks like something went wrong.

 1/1
 FatalErrorException in ConfigDataCollector.php line 276:
 Error: Undefined class constant 'END_OF_MAINTENANCE'

My PHP Version is 5.6.9 on Apache/2.2.15.

Anyone have a clue ?


Thanks Knut


回答1:


I solved this problem by regenerating bootstrap.php.cache (by running composer update / composer install, or directly via script)




回答2:


You can try this:

php composer.phar self-update

before

php composer.phar update



回答3:


The problem was an incompatibility between my different vendors, I have updated my composer.json to :

{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
    "psr-0": { "": "src/" }
},
"require": {
    "php": ">=5.4",
    "symfony/symfony": ">=2.4",
    "doctrine/orm": "~2.2,>=2.2.3",
    "doctrine/doctrine-bundle": ">=1.2",
    "twig/extensions": ">=1.0",
    "symfony/assetic-bundle": ">=2.3",
    "symfony/swiftmailer-bundle": ">=2.3",
    "symfony/monolog-bundle": ">=2.4",
    "sensio/distribution-bundle": ">=2.3",
    "sensio/framework-extra-bundle": ">=3.0",
    "sensio/generator-bundle": ">=2.3",
    "incenteev/composer-parameter-handler": "~2.0",
    "white-october/pagerfanta-bundle": "dev-master",
    "friendsofsymfony/rest-bundle": "1.3.*",
    "friendsofsymfony/comment-bundle": "2.0.*@dev",
    "friendsofsymfony/message-bundle": "1.2.*@dev",
    "friendsofsymfony/user-bundle": "~2.0@dev",
    "nelmio/api-doc-bundle": "@stable",
     "ornicar/akismet-bundle": "dev-master",
    "friendsofsymfony/jsrouting-bundle": "2.0.*@dev",
    "appventus/alertify-bundle": "dev-master",
  "friendsofsymfony/oauth-server-bundle": "dev-master",
  "willdurand/propel-typehintable-behavior": "*",
  "hwi/oauth-bundle": "0.4.*@dev",
  "nomaya/social-bundle": "dev-master"

}
}

and all works ...

Thanks.




回答4:


try:

rm /var/www/html/xxx/app/cache/prod/* -rf



回答5:


For what it's worth, I encountered this issue after upgrading symfony (to 2.8 from 2.6) which was running on a vagrant guest.

The issue was indeed with the app/bootstrap.php.cache file. In our case, it was not excluded from our rsync which meant if the host had not also updated composer the problem would reoccur. It was solved by excluding bootstrap.php.cache from rsync in our Vagrantfile:

config.vm.synced_folder "host/path", "guest/path", type: "rsync", rsync__exclude: [ 'bootstrap.php.cache'],

This file is generated by composer, so running sudo composer install or sudo composer update on the guest will regenerate it.

Hope this saves someone else some time.



来源:https://stackoverflow.com/questions/30775956/symfony2-crash-after-composer-update

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!