silexphp / Silex-WebProfiler

MIT License
210 stars 61 forks source link

Method "request" for object "Silex\Application" does not exist #64

Closed mrohnstock closed 9 years ago

mrohnstock commented 9 years ago

My composer.json:

...
"require": {
        "php": ">=5.5.9",
        "silex/silex": "~2.0@dev",
        "silex/web-profiler": "~2.0@dev",
        "symfony/browser-kit": "~2.6",
        "symfony/class-loader": "~2.6",
        "symfony/config": "~2.6",
        "symfony/yaml": "~2.6",
        "symfony/console": "~2.6",
        "symfony/css-selector": "~2.6",
        "symfony/debug": "~2.6",
        "symfony/finder": "~2.6",
        "symfony/form": "~2.6",
        "symfony/monolog-bridge": "~2.6",
        "symfony/process": "~2.6",
        "symfony/security": "~2.6",
        "symfony/twig-bridge": "~2.6"
},
...

On requesting any route in dev, silex responses with:

Twig_Error_Runtime in Template.php line 485:
Method "request" for object "Silex\Application" does not exist in "@WebProfiler/Profiler/base_js.html.twig" at line 208

I think symfony/symfony#14217 broke something, because I updated all dependencies today, before everything worked flawless. Did I missed something?

Just as a note: Manually hack twig-cache from:

$this->getAttribute((isset($context["app"]) ? $context["app"] : $this->getContext($context, "app")), "request", array())

to

$this->getAttribute($this->getAttribute((isset($context["app"]) ? $context["app"] : $this->getContext($context, "app")), "request_stack", array()), "getCurrentRequest", array())

would prevent this issue and of course force web-profiler-bundle to v2.6.7 in composer.json, too:

"symfony/web-profiler-bundle": "v2.6.7"
patrick-fls commented 9 years ago

:+1: thanks @drmonty, this was driving me mad since everything was fine last night!