将Symfony 3.2升级到3.3时出错 - console.error_listener必须是公共的,因为事件订阅者是延迟加载的

时间:2017-05-31 16:26:57

标签: php symfony symfony-3.2

将Symfony从3.2升级到3.3后,我在clearCache命令上更新了composer后发生了以下错误:

PHP Fatal error:  Uncaught InvalidArgumentException: The service "console.error_listener" must be public as event subscribers are lazy-loaded.

我在vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/console.xml上看到服务console.error_listener设置为public="false"

他们upgrade guide对此没有任何说明。

堆栈追踪:

#0 /www/acme/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php(143): Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass->process(Object(Symfony\Component\DependencyInjection\ContainerBuilder))
#1 /www/acme/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php(736): Symfony\Component\DependencyInjection\Compiler\Compiler->compile(Object(Symfony\Component\DependencyInjection\ContainerBuilder))
#2 /www/acme/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(560): Symfony\Component\DependencyInjection\ContainerBuilder->compile()
#3 /www/acme/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(119): Symfony\Component\HttpKernel\Kernel->ini in /www/acme/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php on line 91

composer.json:

"require": {
    "php": ">=5.6.9",
    "symfony/symfony": "^3.3",
    "doctrine/orm": "^2.5",
    "doctrine/doctrine-bundle": "^1.6",
    "doctrine/doctrine-cache-bundle": "^1.2",
    "symfony/swiftmailer-bundle": "^2.3",
    "symfony/monolog-bundle": "^2.8",
    "sensio/distribution-bundle": "^5.0",
    "sensio/framework-extra-bundle": "^3.0.2",
    "incenteev/composer-parameter-handler": "^2.0",
    "kms/froala-editor-bundle": "dev-master",
    "stavarengo/php-sigep": "dev-master",
    "stavarengo/php-sigep-fpdf": "dev-master",
    "sendgrid/sendgrid": "~5.1",
    "symfony/event-dispatcher": "2.8",
    "guzzlehttp/guzzle": "^6.2",
    "paquettg/php-html-parser": "^1.7",
    "mundipagg/mundipagg-one-php": "^1.4",
    "google/recaptcha": "~1.1",
    "doctrine/annotations": "^1.3",
    "signifyd/signifyd-php": "^0.2.0",
    "league/glide-symfony": "^1.0",
    "algolia/algolia-search-bundle": "^2.2",
    "symfony/assetic-bundle": "^2.8"
}

1 个答案:

答案 0 :(得分:0)

由于某种原因composer.json有以下条目导致问题:

"require": {
    ....
    "symfony/event-dispatcher": "2.8",
    ....
 }

刚刚删除并工作。 当symfony取代它时,这条线不应该存在。