Exception SYMFONY 3.1 | TWIG-Markup.php(从2.9.X迁移后抛出错误)

Exception SYMFONY 3.1 | TWIG-Markup.php(从2.9.X迁移后抛出错误),exception,twig,migration,symfony,symfony-3.1,Exception,Twig,Migration,Symfony,Symfony 3.1,将我的项目从Symfony 2.9.X升级到Symfony 3.1.X后,该网站不断抛出错误: 我目前在这个特殊的问题上左右为难,无法解决它 composer.json: 是PHP接口 添加反斜杠以使用它:\JsonSerializable而不是JsonSerializable,或者在文件顶部添加use语句(使用JsonSerializable;) 否则,它将查看您的包(例如AppBundle\AppBundle\Twig\JsonSerializable,我不知道Markup.php位于何处

将我的项目从Symfony 2.9.X升级到Symfony 3.1.X后,该网站不断抛出错误:

我目前在这个特殊的问题上左右为难,无法解决它

composer.json:

是PHP接口

添加反斜杠以使用它:
\JsonSerializable
而不是
JsonSerializable
,或者在文件顶部添加use语句(
使用JsonSerializable;


否则,它将查看您的包(例如
AppBundle\AppBundle\Twig\JsonSerializable
,我不知道Markup.php位于何处)

AppKernel.php-Dev Log:Prod Log:Markup.php文件第20行及其周围的代码是什么?看起来你只是缺少一个“使用”语句。。。其他错误似乎与您的
config.yml
有关,因此您也需要发布该错误。出现此错误时您使用了哪个PHP版本?PHP 7.0.15是我的服务器配置的最新版本,添加“use”语句似乎无法解决此问题。config.yml错误目前是警告,这些将在Symfony 4发布之前修补。但是,添加反斜杠\JsonSerializable解决了Stephan评论的问题。什么是人员问题?一个真正的问题,得到了答案,标记为已解决。现在成吨的反对票让我被禁止提问——这是你想要推广的社区吗?请考虑建设性的!谢谢。谢谢,添加反斜杠已解决此问题。use语句似乎不起作用,因为这是我的第一个想法。稍后,我将废弃项目文件,并使用干净版本的Symfony 3和port over代码,因为太多的补丁将导致以后出现问题。
{
    "name": "jordan/.checkout",
    "license": "proprietary",
    "type": "project",
    "autoload": {
        "psr-4": {
            "": "src/"
        },
        "classmap": [
            "app/AppKernel.php",
            "app/AppCache.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "require": {
        "php": ">=5.5.9",
        "symfony/symfony": "3.1.*",
        "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",
        "symfony/assetic-bundle": "^2.8.0"
    },
    "require-dev": {
        "sensio/generator-bundle": "^3.0",
        "symfony/phpunit-bridge": "^3.0"
    },
    "scripts": {
        "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::prepareDeploymentTarget"
        ],
        "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::prepareDeploymentTarget"
        ]
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-bin-dir": "bin",
        "symfony-var-dir": "var",
        "symfony-web-dir": "httpdocs",
        "symfony-tests-dir": "tests",
        "symfony-assets-install": "relative",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        }
    }
}