几年后,我正在尝试升级一个旧项目:不幸的是,在将Symfony 2.4.1升级到2.8后,我遇到了阻塞问题。 clear:cache
命令返回以下错误:
PHP Symfony\Component\DependencyInjection\Exception\RuntimeException: Method shouldn't be called. in project/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php on line 95
PHP Stack trace:
PHP 1. {main}() project/app/console:0
PHP 2. Symfony\Component\Console\Application->run() project/app/console:30
PHP 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:123
PHP 4. Symfony\Component\Console\Application->doRun() project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:92
PHP 5. Symfony\Component\Console\Application->doRunCommand() project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:192
PHP 6. Symfony\Component\Console\Command\Command->run() project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:863
PHP 7. Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() project/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:259
PHP 8. Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->warmup() project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:96
PHP 9. Symfony\Component\HttpKernel\Kernel->boot() project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:134
PHP 10. Symfony\Component\HttpKernel\Kernel->initializeContainer() project/app/bootstrap.php.cache:2503
PHP 11. Symfony\Component\DependencyInjection\ContainerBuilder->compile() project/app/bootstrap.php.cache:2725
PHP 12. Symfony\Component\DependencyInjection\Compiler\Compiler->compile() project/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:590
PHP 13. Symfony\Component\DependencyInjection\Compiler\ResolveInvalidReferencesPass->process() project/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php:104
PHP 14. Symfony\Component\DependencyInjection\Compiler\ResolveInvalidReferencesPass->processArguments() project/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php:49`
之后,它还显示了无数其他错误,如下所示:
`PHP Twig_Error_Loader: Unable to find template "SensioDistributionBundle:Configurator/Step:doctrine.html.twig" (looked into: project/app/Resources/views, project/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form). in project/vendor/twig/twig/lib/Twig/Loader/Filesystem.php on line 232`
显然,模板的文件位于另一个目录中。 我相信第一个错误产生了其他错误,因为升级破坏了某种包含。
我的composer.json
就在这里:
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.9",
"symfony/symfony": "^2.8",
"twig/twig": "^1.2",
"doctrine/orm": "^2.4.8",
"doctrine/doctrine-bundle": "~1.4",
"twig/extensions": "~1.3",
"symfony/assetic-bundle": "^2.8",
"symfony/swiftmailer-bundle": "~2.3,>=2.3.10",
"symfony/monolog-bundle": "^3.0.2",
"monolog/monolog": ">=1.8",
"sensio/distribution-bundle": "~4.0",
"sensio/framework-extra-bundle": "^3.0.2",
"sensio/generator-bundle": "^2.5",
"incenteev/composer-parameter-handler": "~2.0",
"jms/security-extra-bundle": "^1.1",
"jms/di-extra-bundle": "^1.4",
"doctrine/doctrine-fixtures-bundle": "^2.2",
"doctrine/doctrine-migrations-bundle": "^1.0",
"doctrine/migrations": "^1.0",
"jms/translation-bundle": "~1.1",
"jms/i18n-routing-bundle": "~1.1",
"jms/serializer-bundle": "^2.0",
"friendsofsymfony/rest-bundle": "^1.7",
"willdurand/jsonp-callback-validator": "^1.0",
"friendsofsymfony/rest": "^1.0",
"knplabs/knp-paginator-bundle": ">=2.3.3",
"friendsofsymfony/jsrouting-bundle": "^1.5",
"friendsofsymfony/user-bundle": "~2.0@dev",
"lexik/maintenance-bundle": "^1.0",
"mtdowling/cron-expression": "^1.0",
"videlalvaro/php-amqplib": "~2.3",
"oldsound/rabbitmq-bundle": "^1.3",
"misd/guzzle-bundle": "1.1.4",
"roderik/pwgen-php": "0.1.3",
"nikic/php-parser": "~1.4.1"
},
"scripts": {
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
]
},
"config": {
"bin-dir": "bin",
"disable-tls": true
},
"minimum-stability": "RC",
"prefer-stable": true,
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.8-dev"
},
"symfony-assets-install": "relative"
}
}
希望有人可以帮助我。