gpt4 book ai didi

php - 供应商更新破坏了 FOS 用户包 "Call to a member function has() on a non-object"

转载 作者:可可西里 更新时间:2023-10-31 22:09:02 24 4
gpt4 key购买 nike

我为 Symfony 2.8 项目更新了我的供应商,突然登录页面没有加载——相反我得到了这个:

Error: Call to a member function has() on a non-object in vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php at line 184

"name": "hazardlog",
"license": "proprietary",
"type": "project",
"autoload": {
"psr-4": {
"": "src/"
},
"classmap": [
"app/AppKernel.php",
"app/AppCache.php"
]
},
"repositories": [
{
"type": "package",
"package": {
"name": "jquery/jquery",
"version": "1.11.1",
"dist": {
"url": "https://code.jquery.com/jquery-1.11.1.js",
"type": "file"
}
}
}
],
"require": {
"php": ">=5.3.9",
"symfony/symfony": "2.8.*",
"doctrine/orm": "^2.4.8",
"doctrine/doctrine-bundle": "~1.4",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"braincrafted/bootstrap-bundle": "~2.0",
"twbs/bootstrap": "3.0.*",
"jquery/jquery": "1.11.*",
"hwi/oauth-bundle": "^0.5.0",
"friendsofsymfony/user-bundle": "~2.0@dev",
"stephanecollot/datetimepicker-bundle": "dev-master"
},
"require-dev": {
"sensio/generator-bundle": "~3.0",
"symfony/phpunit-bridge": "~2.7"
},
"scripts": {
"symfony-scripts": [
"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::prepareDeploymentTarget"
],
"post-install-cmd": [
"@symfony-scripts"
],
"post-update-cmd": [
"@symfony-scripts"
]
},
"config": {
"bin-dir": "bin"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
}
}

最佳答案

我已经多次看到这种问题,但我找不到一个可以接受的答案和解释。就这样吧。

基本问题在于:

"friendsofsymfony/user-bundle": "~2.0@dev",

当 Symfony 2.8/3.0 首次发布时,稳定的 1.x 版本的 FOSUserBundle 不再有效。 2.x 版本已经开发多年,目前尚无实际路线图确定何时稳定。因此,开发分支被黑客入侵以使其正常工作。人们别无选择,只能使用它,这当然很危险,因为您永远不知道开发更改何时可能会破坏您的代码。

时间流逝,最终发布了 FOSUserBundle 的稳定 2.x 版本。然而,相当多的开发人员从未抽出时间更新他们的依赖项并继续使用 master 分支。

快进到现在。 Symfony 4 的发布现在已经在 master 分支中引发了大量的开发。对现有 2.8(可能还有 3.0)代码引入重大更改的开发。

底线是使用一个稳定的分支:

"friendsofsymfony/user-bundle": "~2.0",

随后是 Composer 更新。

关于php - 供应商更新破坏了 FOS 用户包 "Call to a member function has() on a non-object",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48153155/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com