2

Sometimes when there is a bug in my Symfony2 Application I will see the regular exception page, this is not a problem, But then about 3 or 4 seconds later a Javascript alert will popup saying something like

An error occurred while loading the web debug toolbar (404: Not Found). Do you want to open the profiler?

This is extremely annoying as if I have changed focus to another tab or application it pull focus back to that tab in my browser. The profiler is enabled and usually visible, so why is it not showing on this particular error pages and then showing this annoying JS Alert instead.

Can I disable this alert? I have had looked here http://symfony.com/doc/current/reference/configuration/web_profiler.html http://symfony.com/doc/current/reference/configuration/framework.html#profiler

But none of them helped.

(I know I could potentially change settings in my browser or OS but this is the only time JS Alerts are really bothering me)

Sam Anthony
  • 1,669
  • 2
  • 22
  • 39

2 Answers2

0

This usually suggests you have exceeded a recursion (nesting) limit. I think the value of 100 is the default.

Do you happen to use XDebug? If so, this is a well known issue. Read this SO question in order to fix it:

Increasing nesting function calls limit

Community
  • 1
  • 1
Jovan Perovic
  • 19,846
  • 5
  • 44
  • 85
0

You make this:

In the file: ./vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig

before:

confirm('An error occurred while loading the web debug toolbar (' + xhr.status + ': ' + xhr.statusText + ').\n\nDo you want to open the profiler?') && (window.location = '{{ path("_profiler", { "token": token }) }}');

put "return" like this:

function(xhr) {
    if (xhr.status !== 0) {
        return;
        confirm('An error occurred while loading the web debug toolbar (' + xhr.status + ': ' + xhr.statusText + ').\n\nDo you want to open the profiler?') && (window.location = '{{ path("_profiler", { "token": token }) }}');
    }
},

or you may redirect this template like: http://symfony.com/doc/current/templating/overriding.html

Copy file: ./vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig

to: ./app/Resources/WebProfilerBundle/views/Profiler/toolbar_js.html.twig

and modify new file. Add return key word.

Ильдар
  • 963
  • 1
  • 7
  • 11