texthtml / whoops-silex Goto Github PK
View Code? Open in Web Editor NEWIntegrates the Whoops library into Silex
License: GNU Affero General Public License v3.0
Integrates the Whoops library into Silex
License: GNU Affero General Public License v3.0
Hi,
When trying to use this with Silex 2.0 I'm seeing this error:
2015/04/09 09:13:24 [error] 968#0: *51 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Identifier "d" is not defined.' in /vagrant/vendor/pimple/pimple/src/Pimple/Container.php:95
Stack trace:
#0 /vagrant/vendor/texthtml/whoops-silex/src/SilexApplicationHandler.php(30): Pimple\Container->offsetGet('dispatcher_clas...')
#1 /vagrant/vendor/filp/whoops/src/Whoops/Run.php(256): WhoopsSilex\SilexApplicationHandler->handle(Object(InvalidArgumentException))
#2 [internal function]: Whoops\Run->handleException(Object(InvalidArgumentException))
#3 {main}
thrown in /vagrant/vendor/pimple/pimple/src/Pimple/Container.php on line 95
PHP message: PHP Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Identifier "dispatcher_class" is not defined.' in /vagrant/vendor/pimple/pimple/src/Pimple/Container.php:95
Stack trace:
#0 /vagrant/vendor/texthtml/whoops-silex/src/SilexApplicationHandler.php(30): Pimple\Container->offsetGet('dispatcher_clas...')
#1 /vagrant/vendor/filp/whoops/src/Whoops/Run.php(256): WhoopsSilex\SilexApplicationHandler->handle(Object(Whoops\Exception\ErrorException))
#2 /vagrant/vendor/filp/whoops/src/Whoops/Run.php(327): Whoops\Run->handleException(Object(Whoops\Exception\ErrorException))
#3 /vagrant/vendor/filp/whoops/src/Whoops/Run.php(357): Whoops\Run->handleError(1, 'Uncaught except...', '/vagrant/vendor...', 95)
#4 [internal function]: Whoops\Run->handleShutdown()
#5 {main}
thrown in /vagrant/vendor/pimple/pimple/src/Pimple/Container.php on line 95" while reading response header from upstream, client: 10.40.41.1, server: vagrantbox, request: "GET /api/v0/chain/tsh/hotels/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "10.40.41.42"
Here's my lockfile for specific version numbers: https://gist.github.com/EdwardIII/8f6621a7fddf1c2edf17
Not sure if this is an issue with Whoops or Silex+Whoops.
I use the JsonResponseHandler:
$app->register(new WhoopsSilex\WhoopsServiceProvider());
$app['whoops']->pushHandler(new Whoops\Handler\JsonResponseHandler);
In my response I get this header though:
Content-Type:text/html; charset=UTF-8
As far as I can see, Whoops is trying to do the right thing:
https://github.com/filp/whoops/blob/master/src/Whoops/Handler/JsonResponseHandler.php#L84
It does hit this pathway and add the Content-Type header:
if (\Whoops\Util\Misc::canSendHeaders()) {
header('Content-Type: application/json');
}
And if I put a die before it returns Handler::QUIT then the response does come back with application/json:
echo json_encode($response);
die(); # I then see application/json as the header in the output
return Handler::QUIT;
Any idea how I can diagnose whether this is a bug in Whoops or something that's happening between Whoops/Silex?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.