How to change the level of error reporting in Laravel 4?

How can I change PHP error_reporting in L4?

I found this http://forums.laravel.io/viewtopic.php?id=6072 , but it's about L3 and I can’t figure out how to achieve the same goal, that is, prevent the application from php exception throwing E_NOTICE .

+6
source share
3 answers

The user "your common sense" (awesome name btw) is right about fixing the error. Welcome to 2013, an “undefined index error” is a thing of the past these days.

Except when you are working with outdated code that cannot be changed so simply ... So, let's go:

In the file vendor/laravel/framework/src/Illuminate/Foundation/start.php parameter error_reporting() set to -1 , aka: "Report all errors." Try changing the error_reporting level, the link to the manual: http://php.net/manual/en/function.error-reporting.php

Change your global.php in the / app directory and add below: error_reporting(E_ERROR | E_WARNING | E_PARSE);

Undefined index errors are no longer displayed. Feel free to tailor the level to your needs.

[edit] By the way, in app / config / app.php (or app / config / -environment- / app.php you can change the debugging to false. Thus, the user of your application will not receive any technical error messages.

+10
source

Just set error report 0 to app \ start \ global.php at the top of the page.

 error_reporting(0); 
0
source

Referring to the forum you contacted:

Now you need to know how to programmer , you need to fix the error and not hide it.

-1
source

Source: https://habr.com/ru/post/953163/


All Articles