我昨天早上从Symfony 3.1.5升级到3.2.0,一直到一个小时前一切都很好。
现在,Symfony会在任何类型的访问时抛出以下异常,包括控制台命令:
[Symfony的\元器件\ DependencyInjection \异常\ ParameterNotFoundException]
服务“session.storage.metadata_bag”依赖于a 不存在的参数“session.metadata.storage_key”。
我尝试了以下内容:
以下是异常跟踪:
Exception trace:
() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:100
Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->get() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php:56
Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag->get() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:217
Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->resolveString() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:187
Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->resolveValue() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:177
Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->resolveValue() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php:39
Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass->process() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php:120
Symfony\Component\DependencyInjection\Compiler\Compiler->compile() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:565
Symfony\Component\DependencyInjection\ContainerBuilder->compile() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:484
Symfony\Component\HttpKernel\Kernel->initializeContainer() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:116
Symfony\Component\HttpKernel\Kernel->boot() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:68
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /Volumes/Data01/Projects/Beck/WWUI/site/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:122
Symfony\Component\Console\Application->run() at /Volumes/Data01/Projects/Beck/WWUI/site/bin/console:29
正如您所看到的,它是Symfony的一部分,而不是我的代码。
我不知所措
有没有人看过这个?
建议?
编辑1:
根据Dagon的建议,我检查session.xml,看到它看起来是正确的,我决定更换
<argument>%session.metadata.storage_key%</argument>
标记
<argument>_sf2_meta</argument>
在session.xml中。这导致了一个类似的新错误:
[Symfony的\元器件\ DependencyInjection \异常\ ParameterNotFoundException]
服务 “64e3c91c625381e3c2c0184cf9ea0c6d5353986d77aa111949ca6fb8b17a8f07_2” 依赖于不存在的参数“validator.mapping。
cache.prefix”。
答案 0 :(得分:0)
这本身并不是一个答案,但这是一个解决办法 我将供应商重命名为vendor-HOLD,然后运行composer install。问题消失了。
我在旧的和新的session.xml文件上做了一个diff,发现参数的定义不同。导致错误的版本包含:
<parameter string="session.metadata.storage_key">_sf2_meta</parameter>
新安装的版本包含:
<parameter key="session.metadata.storage_key">_sf2_meta</parameter>
代替。显然,其他文件也是错误的,基于我对session.xml所做的实验性编辑。不知道发生了什么,但作曲家安装修复它真好。哦,是的,之后我删除了vendor-HOLD。