Welcome Guest, Not a member yet? Register   Sign In
How to prevent CI from reporting PHP Notice errors
#1

I don't have much experience with CI, but I have inherited a project that uses it.

As the title says, how do you prevent CI from reporting PHP notice errors?

In the index.php file there's the following;

PHP Code:
switch (ENVIRONMENT) {
 
   case 'development':
 
       ini_set('display_errors'1);
 
       ini_set('display_startup_errors'1);
 
       error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
 
       break;
 
   case 'testing':
 
   case 'production':
 
       ini_set('display_errors'0);
 
       if (version_compare(PHP_VERSION'5.3''>=')) {
 
           error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
 
       } else {
 
           error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
 
       }
 
       break;
 
   default:
 
       header('HTTP/1.1 503 Service Unavailable.'TRUE503);
 
       echo 'The application environment is not set correctly.';
 
       exit(1); // EXIT_ERROR
}

I have checked that the environment is set to productionso PHP shouldn't be reporting notice errors, but for some reason CI is still displaying them? 
Reply


Messages In This Thread
How to prevent CI from reporting PHP Notice errors - by shepparddigital - 07-03-2019, 08:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB