我遇到了一个问题,因为我已经更新了Symfony2安装的供应商。
这是我的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"
}
}
在php composer.phar update
之后,当我尝试/app.php时,我会出现以下错误:
Deprecated: The SymfonyComponentSecurityCoreSecurityContextInterface 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 SymfonyComponentSecurityCoreSecurityContext class is deprecated since version 2.6 and will be removed in 3.0. Use SymfonyComponentSecurityCoreAuthenticationTokenStorageTokenStorage or SymfonyComponentSecurityCoreAuthorizationAuthorizationChecker instead. in /var/www/html/xxx/app/cache/prod/classes.php on line 3047
Fatal error: Uncaught exception 'SymfonyComponentDebugExceptionContextErrorException' with message 'Catchable
Fatal Error: Argument 1 passed to SymfonyComponentRoutingRouter::SymfonyComponentRouting{closure}() must be an instance of SymfonyComponentConfigConfigCacheInterface, instance of SymfonyComponentConfigConfigCache 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): SymfonyComponentDebugErrorHandler->handleError(4096, 'Argument 1 pass...', '/var/www/html/p...', 1302, Array)
#1 [internal function]: SymfonyComponentRoutingRouter->SymfonyComponentRouting{closure}(Object(SymfonyComponentConfigConfigCache))
#2 /var/www/html/xxx/vendor/symfony/symfony/src/Symfony/Component/Config/ConfigCacheFactory.php(46): call_user_func(Object(Closure), Object(SymfonyComponentConfigConfigCache))
#3 /var/www/html/xxx/app/cache/prod/classes.php(1313): SymfonyComponentConfigConfigCacheFactory->cache('/var/ww in /var/www/html/xxx/app/cache/prod/classes.php on line 5261
当我转到/app_dev.php时,我有一个:
Whoops, looks like something went wrong.
1/1
FatalErrorException in ConfigDataCollector.php line 276:
Error: Undefined class constant 'END_OF_MAINTENANCE'
我的PHP版本是在Apache/2.2.15上的5.6.9。
有人知道线索吗?
谢谢Knut
我通过重新生成bootstrap.hp.cache(通过运行composer更新/composer安装,或直接通过脚本(
你可以试试这个:
php composer.phar self-update
之前
php composer.phar update
问题是我的不同供应商之间不兼容,我已经将我的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"
}
}
所有的工作。。。
谢谢。
try:
rm /var/www/html/xxx/app/cache/prod/* -rf
值得一提的是,我在将运行在流浪客人上的symfony(从2.6升级到2.8(后遇到了这个问题。
问题确实出在app/bootstrap.php.cache
文件上。在我们的案例中,它没有被排除在rsync
之外,这意味着如果主机没有更新composer
,问题就会再次出现。它是通过在我们的Vagrantfile:中从rsync
中排除bootstrap.php.cache
来解决的
config.vm.synced_folder "host/path", "guest/path", type: "rsync",
rsync__exclude: [ 'bootstrap.php.cache'],
这个文件是由composer
生成的,所以在客户机上运行sudo composer install
或sudo composer update
会重新生成它
希望这能为其他人节省一些时间。