mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 19:34:27 +02:00
add SMARTY_EXCEPTION_HANDLER constant to determine if internal exception handling is enabled
This commit is contained in:
@@ -54,6 +54,14 @@ define('SMARTY_CACHING_OFF', 0);
|
|||||||
define('SMARTY_CACHING_LIFETIME_CURRENT', 1);
|
define('SMARTY_CACHING_LIFETIME_CURRENT', 1);
|
||||||
define('SMARTY_CACHING_LIVETIME_SAVED', 2);
|
define('SMARTY_CACHING_LIVETIME_SAVED', 2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* define exception handling
|
||||||
|
*/
|
||||||
|
if (!defined('SMARTY_EXCEPTION_HANDLER')) {
|
||||||
|
define('SMARTY_EXCEPTION_HANDLER', 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load required base class for creation of the smarty object
|
* load required base class for creation of the smarty object
|
||||||
*/
|
*/
|
||||||
@@ -142,7 +150,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
|||||||
public $default_config_type = 'file';
|
public $default_config_type = 'file';
|
||||||
// class used for cacher
|
// class used for cacher
|
||||||
public $cacher_class = 'Smarty_Internal_Cacher_InlineCode';
|
public $cacher_class = 'Smarty_Internal_Cacher_InlineCode';
|
||||||
// exception handler: set null to disable
|
// exception handler: define SMARTY_EXCEPTION_HANDLER to 0 to disable
|
||||||
public $exception_handler = array('SmartyException', 'getStaticException');
|
public $exception_handler = array('SmartyException', 'getStaticException');
|
||||||
// cached template objects
|
// cached template objects
|
||||||
public $template_objects = null;
|
public $template_objects = null;
|
||||||
@@ -193,7 +201,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
|||||||
}
|
}
|
||||||
$this->start_time = $this->_get_time();
|
$this->start_time = $this->_get_time();
|
||||||
// set exception handler
|
// set exception handler
|
||||||
if (!empty($this->exception_handler))
|
if (SMARTY_EXCEPTION_HANDLER && !empty($this->exception_handler))
|
||||||
set_exception_handler($this->exception_handler);
|
set_exception_handler($this->exception_handler);
|
||||||
// set default dirs
|
// set default dirs
|
||||||
$this->template_dir = array('.' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR);
|
$this->template_dir = array('.' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR);
|
||||||
@@ -244,7 +252,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
|||||||
public function __destruct()
|
public function __destruct()
|
||||||
{
|
{
|
||||||
// restore to previous exception handler, if any
|
// restore to previous exception handler, if any
|
||||||
if (!empty($this->exception_handler))
|
if (SMARTY_EXCEPTION_HANDLER && !empty($this->exception_handler))
|
||||||
restore_exception_handler();
|
restore_exception_handler();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user