/** * @internal Global exception handler. See <set_exception_handler> */ function global_exception_handler($ex) { try { // system_die will handle logging itself. perhaps restructure that to // keep things in place and let that function only handle the exception foreach ($GLOBALS['logging_logger'] as $l) { $l->fatal($ex); } system_die($ex); } catch (Exception $fatal) { foreach ($GLOBALS['logging_logger'] as $l) { $l->addCategory("NESTED_EXCEPTION"); $l->fatal($fatal); $l->removeCategory("NESTED_EXCEPTION"); } } }
use ScavixWDF\Base\AjaxResponse; use ScavixWDF\Base\Args; use ScavixWDF\Base\Renderable; use ScavixWDF\ICallable; use ScavixWDF\Model\DataSource; use ScavixWDF\Reflection\WdfReflector; use ScavixWDF\WdfException; use ScavixWDF\WdfResource; // Config handling system_config_default(!defined("NO_DEFAULT_CONFIG")); if (file_exists("config.php")) { include "config.php"; } elseif (file_exists(__DIR__ . "/config.php")) { include __DIR__ . "/config.php"; } elseif (!defined("NO_CONFIG_NEEDED")) { system_die("No valid configuration found!"); } /** * Loads a config file. * * Should not be used if a config file is present in root path. * @param string $filename Full path to the config file * @param bool $reset_to_defaults If true resets the complete config to the one to read * @return void */ function system_config($filename, $reset_to_defaults = true) { global $CONFIG; if ($reset_to_defaults) { system_config_default(); }
/** * @internal Global shutdown handler. See <register-shutdown-function> */ function global_fatal_handler() { $error = error_get_last(); if ($error === NULL || $error['type'] !== E_ERROR) { return; } $ex = new WdfException($error["message"]); try { // system_die will handle logging itself. perhaps restructure that to // keep things in place and let that function only handle the exception foreach ($GLOBALS['logging_logger'] as $l) { $l->fatal($ex); } system_die($ex, var_export($error, true)); } catch (Exception $fatal) { foreach ($GLOBALS['logging_logger'] as $l) { $l->addCategory("NESTED_EXCEPTION"); $l->fatal($fatal); $l->removeCategory("NESTED_EXCEPTION"); } } }