Symfony 3加载Web调试工具栏时发生错误

时间:2017-10-12 19:32:48

标签: php symfony profiler symfony-3.2

嗨我的调试工具栏有问题,当我尝试加载页面时(在localhost上)所有代码都正确加载但是在加载代码后出现了警告:

  

加载Web调试工具栏时出错(500:内部服务器错误)。你想打开探查器吗?

我可以选择:确定或取消。

当我点击取消时没有任何反应,但如果我点击确定我得到(http://127.0.0.1:8000/_profiler/ae356f):

  

命名空间没有注册路径" security"。

{% block menu %}
        <span class="label {{ not collector.enabled or not collector.token ? 'disabled' }}">
            <span class="icon">{{ include('@security/Collector/icon.svg') }}</span>
            <strong>Security</strong>
        </span>
{% endblock %}

我可以分享Composer文件:

{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-4": { "": "src/" },
        "classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
    },
    "autoload-dev": {
        "psr-4": { "Tests\\": "tests/" },
        "files": [ "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php" ]
    },
    "require": {
        "php": ">=5.5.9",
        "doctrine/doctrine-bundle": "^1.6",
        "doctrine/doctrine-cache-bundle": "^1.2",
        "doctrine/orm": "^2.5",
        "incenteev/composer-parameter-handler": "^2.0",
        "sensio/distribution-bundle": "^5.0",
        "sensio/framework-extra-bundle": "^3.0.2",
        "symfony/monolog-bundle": "^3.0.2",
        "symfony/polyfill-apcu": "^1.0",
        "symfony/swiftmailer-bundle": "^2.3.10",
        "symfony/symfony": "3.2.*",
        "twig/twig": "^1.0||^2.0",
        "symfony/assetic-bundle": "2.8.1",
        "doctrine/doctrine-migrations-bundle": "^1.0"
    },
    "require-dev": {
        "sensio/generator-bundle": "^3.0",
        "symfony/phpunit-bridge": "^3.0"
    },
    "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": {
        "platform": {
            "php": "5.5.9"
        },
        "sort-packages": true
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-bin-dir": "bin",
        "symfony-var-dir": "var",
        "symfony-web-dir": "web",
        "symfony-tests-dir": "tests",
        "symfony-assets-install": "relative",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "3.2-dev"
        }
    }
}

你们有什么想法可以解决这个问题的原因吗?我已经尝试了this解决方案但没有效果。请帮忙。

1 个答案:

答案 0 :(得分:0)

在法国网站openclassroom.fr,一个人有同样的错误500.我不知道真正的隐藏错误,但他的错误是

  

安全上下文不包含身份验证令牌。一种可能   原因可能是没有为此URL配置防火墙。

问题似乎是测试令牌是否存在:

if(null == $this->securityContext->getToken() && HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType())
{
    return;
}