0

I'm riding the structure based config file containing the type of ini_set. Then I fill the first class Config file containing the parameters and then I continue the application process.

after the files are loaded, and set ini_set, any error will be triggered and correctly captured; this case the error would be 02

the doubt is whether any error is raised before executing the function settings(), the ini_set is not set, this error would be the case 01 and would like to know how to get around this problem.

try
{
    # trigger_error( 'case 01, example error' , E_USER_ERROR );

    # include
    Loader::import( 'configure.php' );
    Loader::import( 'config.php'    );

    # ini set
    settings();

    # execute application

    # trigger_error( 'case 02, example error' , E_USER_ERROR );
}
catch( Exception $e )
{
    echo 'critical error';
}


function settings()
{
    ini_set( 'error_reporting' , Config::read( 'settings.error_reporting' ) );
    ini_set( 'display_errors'  , Config::read( 'settings.display_errors'  ) );
    ini_set( 'default_charset' , Config::read( 'settings.charset'         ) );
    ini_set( 'date.timezone'   , Config::read( 'settings.timezone'        ) );
}
  1. import method is a class loader
  2. config file contains the data of ini_set:

Config::write ('ErrorReporting', E_ALL);

config, is class

configure, contains the values

if someone has not understood something, explain again

thanks

Papa Charlie
  • 625
  • 8
  • 31

1 Answers1

0

Say if I have misunderstood the problem but the first thing I notice is:

import( 'configure.php' );
import( 'config.php' );

Normally one uses require, include, include_once or require_once:

include( 'configure.php' )
include( 'config.php' );

Also, why are there two configuration files?

ale
  • 11,636
  • 27
  • 92
  • 149
  • **1.** import method is a class loader **2.** config file contains the data of ini_set: Config::write ('ErrorReporting', E_ALL); – Papa Charlie Apr 06 '12 at 09:38