How can i change the 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 that same goal, that is prevent the application from throwing exception on php E_NOTICE.
Through your config/app. php , set 'debug' => env('APP_DEBUG', false), to true . Or in a better way, check out your . env file and make sure to set the debug element to true.
By default, error detail is enabled for your application. This means that when an error occurs you will be shown an error page with a detailed stack trace and error message. You may turn off error details by setting the debug option in your app/config/app. php file to false .
To turn off or disable error reporting in PHP, set the value to zero. For example, use the code snippet: <? php error_reporting(0); ?>
User "your common sense" (awesome name btw) is right about fixing the error. Welcome in 2013, the 'undefined index error' is a thing from the past these days.
Except if you are working with legacy code which can't be altered that simple... So here we go:
In the file vendor/laravel/framework/src/Illuminate/Foundation/start.php
the error_reporting()
is set to -1
, aka: "report ALL the errors".
Try to change the level of error_reporting, link to manual: http://php.net/manual/en/function.error-reporting.php
Edit your global.php
in the /app directory, and add at the bottom: error_reporting(E_ERROR | E_WARNING | E_PARSE);
Undefined index errors wont show anymore. Feel free to adjust the level to your needs.
[edit] Ow by the way: in app/config/app.php (or app/config/-environment-/app.php you can alter the debug to false. In this way the user of your app wont getting any technical error-messages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With