diff --git a/change_log.txt b/change_log.txt index 0728b23f..95b49c93 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,5 +1,6 @@ 11/09/2009 - lexer/parser bugfix +- new SMARTY_SPL_AUTOLOAD constant to control the autoloader option 11/08/2009 - fixed alphanumeric array index diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 4fff5342..3899f141 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -87,8 +87,18 @@ define('SMARTY_PHP_ALLOW', 3); //-> escape tags as entities /** * register the class autoloader */ -spl_autoload_register('smartyAutoload'); - +if (!defined('SMARTY_SPL_AUTOLOAD')) { + define('SMARTY_SPL_AUTOLOAD',0); +} + +if (SMARTY_SPL_AUTOLOAD && set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== false) { + $registeredAutoLoadFunctions = spl_autoload_functions(); + if (!isset($registeredAutoLoadFunctions['spl_autoload'])) { + spl_autoload_register(); + } +} else { + spl_autoload_register('smartyAutoload'); +} /** * This is the main Smarty class