php - Symfony2 WebProfiler (500): Variable "app" does not exist in @Doctrine/Collector/db.html.twig at line 1

843

It's actually the first time for very long that I haven't found a single search result for an error message. On every page load I get a popup message saying:

"An error occurred while loading the web debug toolbar (500: Internal Server Error). Do you want to open the profiler?" And when I open the profiler / logs:

Variable "app" does not exist in @Doctrine/Collector/db.html.twig at line 1  

I made some translations and edits of twig templates - really nothing fancy. Now the profiler fails to load on every page.

my composer.json:

"require": {
    "php": ">=5.3.3",
    "symfony/symfony": "2.6.*",
    "doctrine/orm": ">=2.2.3,<2.4-dev",
    "doctrine/doctrine-bundle": "1.4.*",
    "twig/extensions": "1.*",
    "symfony/assetic-bundle": "2.3.*",
    "symfony/swiftmailer-bundle": "2.3.*",
    "symfony/monolog-bundle": "2.3.*",
    "sensio/distribution-bundle": "2.3.*",
    "sensio/framework-extra-bundle": "2.3.*",
    "sensio/generator-bundle": "2.3.*",
    "incenteev/composer-parameter-handler": "~2.0",
    "stof/doctrine-extensions-bundle": "[email protected]",
    "friendsofsymfony/user-bundle": "1.3.*@dev",
    "doctrine/doctrine-fixtures-bundle": "2.2.*",
    "doctrine/migrations": "1.0.*@dev",
    "doctrine/doctrine-migrations-bundle": "~1.0"
},

caches cleared, etc. I'm not asking for a solution but do you have any clue what the case could be here?

Thank you very much for your help & time!

Moritz

507

Answer

Solution:

It may still be related to the cache, try to rebuild your bootstrap cache in addition to cache:clear prod & dev.

 php ./vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php

PS: the path may be different in your symfony version.

People are also looking for solutions to the problem: javascript - Instagram grabbing photos based on hashtag

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.