php – 供应商更新打破了FOS用户捆绑包“在非对象上调用成员函数has()”

前端之家收集整理的这篇文章主要介绍了php – 供应商更新打破了FOS用户捆绑包“在非对象上调用成员函数has()”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我为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版本已经开发多年,没有实际的路线图可以确定何时稳定.所以开发分支被破解以使其正常工作.人们别无选择,只能使用它当然是危险的,因为你永远不知道发展变化何时可能会破坏你的代码.

时间流逝,最终发布了稳定的2.x版本的FOSUserBundle.但是,相当多的开发人员从未到过更新其依赖关系并继续使用master分支.

快进到现在. Symfony 4的发布现在已经在主分支中引发了相当大的发展.开发正在对现有的2.8(可能是3.0)代码进行重大更改.

底线是使用稳定的分支:

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

然后是作曲家更新.

原文链接:https://www.f2er.com/php/138879.html

猜你在找的PHP相关文章