Welcome Guest, Not a member yet? Register   Sign In
What is the expected output of ini_set('display_errors', 0)?
#1

hi,

I'm in doubt about a fairly basic thing. CodeIgniter's standard index.php file, which I did not modify in any way, follows this general best practice:

switch (ENVIRONMENT)
{
   case 'development':
      error_reporting(-1);
      ini_set('display_errors'1);
   break;

   case 'testing':
   case 'production':
      ini_set('display_errors'0);


Indeed, we do not want to show detailed technical errors to users once we're in production. However, if any general error occurs, what exactly should the user see if display errors is disabled? I would expect that this...

 ini_set('display_errors'0);

Will not show error details to the user, however, it should show something. Currently, when I forcefully disable error display as above, I get a full 500 error in the browser (in Chrome showing that broken face icon) when forcing a runtime exception (for example PHP parse error or loading a model that does not exist).

Is this as expected? 

I would expect that error details are not exposed, yet CI should still show something of a generic "whoops" error page in this case. 

A 500 error can of course also be caused by config issues at Apache level, yet my setup generally works well and the Apache error log does not show any particular alternative causes. 

So my question: when display errors is disabled (as it should be in production) what will CI do when it encounters a runtime exception? What should it do? I'm trying to figure out if this is normal behavior (which would surprise me) or somehow I still do have some local problem in my setup.

Thanks for any help you can offer!
Reply


Messages In This Thread
What is the expected output of ini_set('display_errors', 0)? - by ferdy - 09-07-2020, 02:57 PM



Theme © iAndrew 2016 - Forum software by © MyBB