leafsphp / leaf

🍁 The easiest way to create clean, simple but powerful web apps and APIs quickly

Home Page:https://leafphp.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

debug = false not worked as expected

swimitup opened this issue · comments

If you try to disable debug mode to not show code or more details on-screen when you got an error 500, the .env

APP_DEBUG=false

or instruction

app()->config('debug',false)

will not prevent the nice debug screen to show up.

Screen Shot 2022-09-26 at 2 18 30 PM

Code

app()->config(['debug' => false]);

will not work either.

If you set debug to false in _app.php, for example, and var_dump the variable, you will get false. But if you try to var_dump the variable inside App.php class, you will get true:

Screen Shot 2022-09-26 at 2 31 43 PM

/Users/julian/uc-api/vendor/leafs/leaf/src/App.php:73:boolean true

It seems the "debug" variable is not controlled by the Config::static:$settings array, but from within the /config/app.php script:

Screen Shot 2022-09-26 at 3 15 47 PM

But still if you define the variable afterwards, in _app.php script, it will not work:

Leaf\Config::set([
    "views.path" => "views",
    "views.cachePath" => "views/cache",
    'log.style' => 'linux',
    'log.enabled' => true,
    'log.dir' => __DIR__ . '/../../storage/logs/',
    'log.file' => 'uc-api-'.date('Y-m-d').'.log',
    'debug' => false,
]);

I'll take a look at this

@swimitup This has been fixed in Leaf's new release. You can run composer update in your project to get rid of this error.