我目前正在尝试将Symfony 3.3更新到最新的Symfony 3.4(将在支持用完之前将其移植到Symfony 4,没有时间重写系统)和PHP 7.因为PHP 7.3似乎不适用于3.4决定现在继续使用PHP 7.2。
我更新了composer.json,运行了composer install(并使用依赖项进行更新)并清除了缓存。然而,在作曲家内部完美无瑕地工作之后,我试图通过以下消息访问我受到欢迎的系统:
致命错误:未捕获错误:E:\ XAMPP7_2 \ htdocs \ wsm-rando \ vendor \ symfony \ symfony \ src \ Symfony \ Bundle \ FrameworkBundle \ DependencyInjection \ Compiler \ CachePoolPass.php中的未定义类常量'IGNORE_ON_UNINITIALIZED_REFERENCE':堆栈跟踪: #0 E:\ XAMPP7_2 \ htdocs \ wsm-rando \ vendor \ symfony \ symfony \ src \ Symfony \ Component \ DependencyInjection \ Compiler \ Compiler.php(141):Symfony \ Bundle \ FrameworkBundle \ DependencyInjection \ Compiler \ CachePoolPass-> process (对象(Symfony \ Component \ DependencyInjection \ ContainerBuilder))#1 E:\ XAMPP7_2 \ htdocs \ wsm-rando \ vendor \ symfony \ symfony \ src \ Symfony \ Component \ DependencyInjection \ ContainerBuilder.php(788):Symfony \ Component \ DependencyInjection \ Compiler \ Compiler-> compile(Object(Symfony \ Component \ DependencyInjection \ ContainerBuilder))#2 E:\ XAMPP7_2 \ htdocs \ wsm-rando \ vendor \ symfony \ symfony \ src \ Symfony \ Component \ HttpKernel \ Kernel.php (637):Symfony \ Component \ DependencyInjection \ ContainerBuilder-> compile()#3 E:\ XAMPP7_2 \ htdocs \ wsm-rando \ vendor \ symfony \ symfony \ src \ Sy第93行的E:\ XAMPP7_2 \ htdocs \ wsm-rando \ vendor \ symfony \ symfony \ src \ Symfony \ Bundle \ FrameworkBundle \ DependencyInjection \ Compiler \ CachePoolPass.php中的mfony \ Component \ HttpKernel \ Kernel.php
有没有想过我怎么能解决这个问题?我确定我安装了错误的包或其他东西。这是composer.json的参考:
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/", "SymfonyStandard": "app/" }
},
"require": {
"php": ">=5.5.9",
"symfony/symfony": "3.4.*",
"doctrine/orm": "^2.5",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/doctrine-cache-bundle": "^1.2",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "^3.1",
"sensio/distribution-bundle": "^5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "^2.0",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"faceleg/html5lib-php": "dev-master",
"smalot/pdfparser": "*",
"seostats/seostats": "dev-master",
"nategood/httpful": "*",
"twbs/bootstrap": "*",
"friendsofsymfony/user-bundle": "2.0.*",
"phpoffice/phpspreadsheet": "^1.1",
"ext-json": "*"
},
"require-dev": {
"sensio/generator-bundle": "^3.0"
},
"scripts": {
"post-root-package-install": [
"SymfonyStandard\\Composer::hookRootPackageInstall"
],
"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",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles"
],
"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",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles"
]
},
"config": {
"bin-dir": "bin"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-var-dir": "var",
"symfony-bin-dir": "bin",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.5-dev"
}
}
}
我能够在Symfony Devs Slack小组的帮助下解决这个问题。事实证明,常量确实已设置,但由于某些错误的缓存,它未包含在运行时中。
要解决此问题,我必须手动删除cache/prod
和cache/dev
文件夹,而不是使用bin/console cache:clear
命令。