diff --git a/config.inc.php b/config.inc.php index 5b82d0e..f00b2f4 100644 --- a/config.inc.php +++ b/config.inc.php @@ -5,6 +5,7 @@ use Exception; $GLOBALS['CONFIG_BASE_DIRS'] = array(); $GLOBALS['CONFIG_INIT_WORKER_FUNC'] = null; $GLOBALS['CONFIG_FILTER_FN'] = null; +$GLOBALS['CONFIG_BASE_CLASS'] = '\ConfBase'; task('config_worker', function(array $args) { @@ -870,6 +871,9 @@ function config_load_ex($conf_dir, $file, array $arr, $id = null) if(!class_exists($klass)) throw new Exception("No such class '$klass'"); $cnf = new $klass; + if(!is_a($cnf, $GLOBALS['CONFIG_BASE_CLASS'])) + throw new Exception("Class '$klass' must inherit from '{$GLOBALS['CONFIG_BASE_CLASS']}'"); + $cnf->import($arr, true); } catch(Exception $e)