silexphp / Silex-Skeleton

A skeleton to get started with Silex
MIT License
780 stars 197 forks source link

An error occurred while loading the web debug toolbar (500: Internal Server Error). #69

Open jeremykendall opened 8 years ago

jeremykendall commented 8 years ago

After installing the skeleton per the instructions in the README and running COMPOSER_PROCESS_TIMEOUT=0 composer run and visit http://localhost:8888 or http://localhost:8888/index_dev.php I get the following error in a JS alert:

An error occurred while loading the web debug toolbar (500: Internal Server Error).

Do you want to open the profiler?

That error pops up every time I click "OK". When I hit "Cancel" I see the following:

RuntimeException in ArgumentResolver.php line 82: Controller "Symfony\Bundle\WebProfilerBundle\Controller\ProfilerController::panelAction()" requires that you provide a value for the "$request" argument (because there is no default value or because there is a non optional argument after this one).

    in ArgumentResolver.php line 82
    at ArgumentResolver->getArguments(object(Request), array(object(ProfilerController), 'panelAction')) in HttpKernel.php line 145
    at HttpKernel->handleRaw(object(Request), '1') in HttpKernel.php line 68
    at HttpKernel->handle(object(Request), '1', true) in Application.php line 496
    at Application->handle(object(Request)) in Application.php line 477
    at Application->run() in index_dev.php line 22

Environment: Ubuntu 16.04 LTS and PHP 7.1.0beta3:

PHP 7.1.0beta3 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.1.0beta3, Copyright (c) 1999-2016, by Zend Technologies

Silex Skeleton version "~2.0@dev"

fabpot commented 8 years ago

Can you show me the output of composer show, because I'm not able to reproduce it here with the following deps:

monolog/monolog             1.21.0  Sends your logs to files, sockets, inboxes, databases and various web services
paragonie/random_compat     v2.0.2  PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
pimple/pimple               v3.0.2  Pimple, a simple Dependency Injection Container
psr/log                     1.0.0   Common interface for logging libraries
silex/silex                 v2.0.3  The PHP micro-framework based on the Symfony Components
silex/web-profiler          v2.0.2  A WebProfiler for Silex
symfony/asset               v3.0.9  Symfony Asset Component
symfony/browser-kit         v3.0.9  Symfony BrowserKit Component
symfony/class-loader        v3.0.9  Symfony ClassLoader Component
symfony/config              v3.0.9  Symfony Config Component
symfony/console             v3.0.9  Symfony Console Component
symfony/css-selector        v3.0.9  Symfony CssSelector Component
symfony/debug               v3.0.9  Symfony Debug Component
symfony/dom-crawler         v3.1.4  Symfony DomCrawler Component
symfony/event-dispatcher    v3.1.4  Symfony EventDispatcher Component
symfony/filesystem          v3.1.4  Symfony Filesystem Component
symfony/finder              v3.0.9  Symfony Finder Component
symfony/form                v3.0.9  Symfony Form Component
symfony/http-foundation     v3.1.4  Symfony HttpFoundation Component
symfony/http-kernel         v3.1.4  Symfony HttpKernel Component
symfony/inflector           v3.1.4  Symfony Inflector Component
symfony/intl                v3.1.4  A PHP replacement layer for the C intl extension that includes additional data from the ICU library.
symfony/monolog-bridge      v3.0.9  Symfony Monolog Bridge
symfony/options-resolver    v3.1.4  Symfony OptionsResolver Component
symfony/polyfill-intl-icu   v1.2.0  Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring   v1.2.0  Symfony polyfill for the Mbstring extension
symfony/polyfill-php56      v1.2.0  Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70      v1.2.0  Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util       v1.2.0  Symfony utilities for portability of PHP codes
symfony/process             v3.0.9  Symfony Process Component
symfony/property-access     v3.1.4  Symfony PropertyAccess Component
symfony/routing             v3.1.4  Symfony Routing Component
symfony/security            v3.0.9  Symfony Security Component
symfony/stopwatch           v3.1.4  Symfony Stopwatch Component
symfony/translation         v3.0.9  Symfony Translation Component
symfony/twig-bridge         v3.0.9  Symfony Twig Bridge
symfony/validator           v3.0.9  Symfony Validator Component
symfony/web-profiler-bundle v3.1.4  Symfony WebProfilerBundle
twig/twig                   v1.24.2 Twig, the flexible, fast, and secure template language for PHP
jeremykendall commented 8 years ago

Here you go. Thanks!

monolog/monolog             1.21.0  Sends your logs to files, sockets, inboxes, databases and various web services
paragonie/random_compat     v2.0.2  PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
pimple/pimple               v3.0.2  Pimple, a simple Dependency Injection Container
psr/log                     1.0.0   Common interface for logging libraries
silex/silex                 v2.0.3  The PHP micro-framework based on the Symfony Components
silex/web-profiler          v2.0.2  A WebProfiler for Silex
symfony/asset               v3.0.9  Symfony Asset Component
symfony/browser-kit         v3.0.9  Symfony BrowserKit Component
symfony/class-loader        v3.0.9  Symfony ClassLoader Component
symfony/config              v3.0.9  Symfony Config Component
symfony/console             v3.0.9  Symfony Console Component
symfony/css-selector        v3.0.9  Symfony CssSelector Component
symfony/debug               v3.0.9  Symfony Debug Component
symfony/dom-crawler         v3.1.3  Symfony DomCrawler Component
symfony/event-dispatcher    v3.1.3  Symfony EventDispatcher Component
symfony/filesystem          v3.1.3  Symfony Filesystem Component
symfony/finder              v3.0.9  Symfony Finder Component
symfony/form                v3.0.9  Symfony Form Component
symfony/http-foundation     v3.1.3  Symfony HttpFoundation Component
symfony/http-kernel         v3.1.3  Symfony HttpKernel Component
symfony/inflector           v3.1.3  Symfony Inflector Component
symfony/intl                v3.1.3  A PHP replacement layer for the C intl extension that includes additional data from the ICU library.
symfony/monolog-bridge      v3.0.9  Symfony Monolog Bridge
symfony/options-resolver    v3.1.3  Symfony OptionsResolver Component
symfony/polyfill-intl-icu   v1.2.0  Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring   v1.2.0  Symfony polyfill for the Mbstring extension
symfony/polyfill-php56      v1.2.0  Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70      v1.2.0  Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util       v1.2.0  Symfony utilities for portability of PHP codes
symfony/process             v3.0.9  Symfony Process Component
symfony/property-access     v3.1.3  Symfony PropertyAccess Component
symfony/routing             v3.1.3  Symfony Routing Component
symfony/security            v3.0.9  Symfony Security Component
symfony/stopwatch           v3.1.3  Symfony Stopwatch Component
symfony/translation         v3.0.9  Symfony Translation Component
symfony/twig-bridge         v3.0.9  Symfony Twig Bridge
symfony/validator           v3.0.9  Symfony Validator Component
symfony/web-profiler-bundle v3.1.3  Symfony WebProfilerBundle
twig/twig                   v1.24.1 Twig, the flexible, fast, and secure template language for PHP
jeremykendall commented 8 years ago

Here's a diff between our output, FWIW:

14,16c14,16
< symfony/dom-crawler         v3.1.3  Symfony DomCrawler Component
< symfony/event-dispatcher    v3.1.3  Symfony EventDispatcher Component
< symfony/filesystem          v3.1.3  Symfony Filesystem Component
---
> symfony/dom-crawler         v3.1.4  Symfony DomCrawler Component
> symfony/event-dispatcher    v3.1.4  Symfony EventDispatcher Component
> symfony/filesystem          v3.1.4  Symfony Filesystem Component
19,22c19,22
< symfony/http-foundation     v3.1.3  Symfony HttpFoundation Component
< symfony/http-kernel         v3.1.3  Symfony HttpKernel Component
< symfony/inflector           v3.1.3  Symfony Inflector Component
< symfony/intl                v3.1.3  A PHP replacement layer for the C intl extension that includes additional data from the ICU library.
---
> symfony/http-foundation     v3.1.4  Symfony HttpFoundation Component
> symfony/http-kernel         v3.1.4  Symfony HttpKernel Component
> symfony/inflector           v3.1.4  Symfony Inflector Component
> symfony/intl                v3.1.4  A PHP replacement layer for the C intl extension that includes additional data from the ICU library.
24c24
< symfony/options-resolver    v3.1.3  Symfony OptionsResolver Component
---
> symfony/options-resolver    v3.1.4  Symfony OptionsResolver Component
31,32c31,32
< symfony/property-access     v3.1.3  Symfony PropertyAccess Component
< symfony/routing             v3.1.3  Symfony Routing Component
---
> symfony/property-access     v3.1.4  Symfony PropertyAccess Component
> symfony/routing             v3.1.4  Symfony Routing Component
34c34
< symfony/stopwatch           v3.1.3  Symfony Stopwatch Component
---
> symfony/stopwatch           v3.1.4  Symfony Stopwatch Component
38,39c38,39
< symfony/web-profiler-bundle v3.1.3  Symfony WebProfilerBundle
< twig/twig                   v1.24.1 Twig, the flexible, fast, and secure template language for PHP
---
> symfony/web-profiler-bundle v3.1.4  Symfony WebProfilerBundle
> twig/twig                   v1.24.2 Twig, the flexible, fast, and secure template language for PHP
jeremykendall commented 8 years ago

Here are screenshots of what I'm seeing.

screenshot from 2016-09-10 14-52-24

screenshot from 2016-09-10 14-54-14

fabpot commented 8 years ago

What if you run composer up to get the same versions as mine?

jeremykendall commented 8 years ago

Same result 😦

fabpot commented 8 years ago

I don't really understand how that's possible. Can you add print get_class($resolver)."<br />\n"; after line 55 in vendor/symfony/http-kernel/Controller/ArgumentResolver.php and tell me what it outputs?

jeremykendall commented 8 years ago
Silex\AppArgumentValueResolver
Symfony\Component\HttpKernel\Controller\ArgumentResolver\RequestAttributeValueResolver
Symfony\Component\HttpKernel\Controller\ArgumentResolver\RequestValueResolver
Symfony\Component\HttpKernel\Controller\ArgumentResolver\DefaultValueResolver
Symfony\Component\HttpKernel\Controller\ArgumentResolver\VariadicValueResolver

screenshot from 2016-09-10 16-02-04

fabpot commented 8 years ago

Can you send me a zip of the project (fabien ... symfony.com)? you should have Silex\AppArgumentValueResolver listed here, but for some reasons you don't.

jeremykendall commented 8 years ago

Sure thing! It should be on its way now.

fabpot commented 8 years ago

@jeremykendall Not received it yet :(

jeremykendall commented 8 years ago

Hmmm. Just sent a test email your way to see if it gets through. It's coming from jeremy at jeremy kendall dot net.

Mokto commented 7 years ago

I unfortunately get this issue as well. I would be happy to give more information.

Mokto commented 7 years ago

But I did git clone / composer install / composer run-script run / navigate to http://localhost:8888/index_dev.php

I am on windows 7 / php 7.1

piotr-sikora-v commented 7 years ago

I have same issue. In log I found: ` [2017-01-02 07:13:52] app.CRITICAL: Twig_Error_Runtime: An exception has been thrown during the rendering of a template ("Warning: strtr() expects parameter 1 to be string, object given"). (uncaught exception) at /media/tmp/silext-test/vendor/symfony/web-profiler-bundle/Resources/views/Collector/request.html.twig line 271 {"exception":"[object] (Twig_Error_Runtime(code: 0): An exception has been thrown during the rendering of a template (\"Warning: strtr() expects parameter 1 to be string, object given\"). at /media/tmp/silext-test/vendor/symfony/web-profiler-bundle/Resources/views/Collector/request.html.twig:271, Symfony\Component\Debug\Exception\ContextErrorException(code: 0): Warning: strtr() expects parameter 1 to be string, object given at /media/tmp/silext-test/vendor/symfony/twig-bridge/Extension/CodeExtension.php:196)"} []

`

bastien-g commented 7 years ago

I had same error, seems to be due to #75 As @allejo pointed out twig-bridge 3.2 fixed it for me. So I replaced "symfony/twig-bridge": "~2.8|3.0.*", by "symfony/twig-bridge": "~3.2", in my composer.json and updated with composer.

cherifGsoul commented 7 years ago

@bastien-g Can you please tell me if you have now an error on the profiling page?

Because with your fix I have an error on index_dev.php/_profiler/529983?panel=request

Update: I cleaned the cache and all is working fine now, so dont forget to clean the cache in var folder after deps update

t-initi commented 7 years ago

I had the error after i deployed my app. The way i resolved it is by doing a clear cache on the deployed app. you can clear the cache of a deployed app by using an ssh connection.

Do you get this error locally(meaning on an app that is on the local server) ?

cherifGsoul commented 7 years ago

@t-initi yes I did locally

casenjo commented 7 years ago

@bastien-g thanks for that! Fixed the issue right up when running the latest Silex Skeleton (as of today)