zeuxisoo / php-slim-whoops

PHP whoops error on slim framework
131 stars 10 forks source link

For a what you disable debug mode? #14

Closed tarampampam closed 8 years ago

tarampampam commented 8 years ago
...

class WhoopsMiddleware extends Middleware {
    public function call() {
        $app = $this->app;

        if ($app->config('debug') === true) {
            // Switch to custom error handler by disable debug
            $app->config('debug', false);
//          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

...

Why you make this? Debug mode is important for other components!

zeuxisoo commented 8 years ago

Your question is related slim framework 2.x version and it change history. In the latest version of slim, you can look in to this line. Also. If you want more information about this question, you may need to review the slim workflow.

danielemontesi commented 7 years ago

@zeuxisoo , please could you give us a short explanation ? Thank you.

zeuxisoo commented 7 years ago

@danielemontesi Thank you for your question.

This option is only needed for Slim 2.x version. In Slim 2.x, it will add the default exception middleware on top of middleware stack if the debug mode is enabled. So, we need to disable this action before adding the custom middleware

If you want more information, please see my previous comment and review the Slim 2.x code. it is related slim how to process the web request.