-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
trying to fix the fatal error handling #2
- Loading branch information
1 parent
1c9525b
commit bb329be
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
use Interop\Http\ServerMiddleware\MiddlewareInterface; | ||
use Interop\Http\ServerMiddleware\DelegateInterface; | ||
use Whoops\Run; | ||
use Whoops\Util\SystemFacade; | ||
use Whoops\Handler\PrettyPageHandler; | ||
use Whoops\Handler\PlainTextHandler; | ||
use Whoops\Handler\JsonResponseHandler; | ||
|
@@ -105,7 +106,20 @@ public function process(ServerRequestInterface $request, DelegateInterface $dele | |
*/ | ||
private static function getWhoopsInstance(ServerRequestInterface $request) | ||
{ | ||
$whoops = new Run(); | ||
$system = new SystemFacade(); | ||
$whoops = new Run($system); | ||
|
||
//E_ERROR in PHP 5.x | ||
if (!class_exists('Throwable')) { | ||
$system->registerShutdownFunction(function () use ($whoops) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
oscarotero
Author
Member
|
||
$whoops->allowQuit(true); | ||
$whoops->writeToOutput(true); | ||
$whoops->sendHttpCode(true); | ||
|
||
$method = Run::SHUTDOWN_HANDLER; | ||
$whoops->$method(); | ||
}); | ||
} | ||
|
||
switch (self::getPreferredFormat($request)) { | ||
case 'json': | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This won't work for us, we rely on dependency-injected
Run
instance.