From 4f5aeeb2b6255dd01776b70e3d04bbf5e9dd5f89 Mon Sep 17 00:00:00 2001 From: uwetews Date: Wed, 2 Mar 2016 18:17:22 +0100 Subject: [PATCH] - revert autoloader optimizations because of unexplainable warning when using plugins https://github.com/smarty-php/smarty/issues/199 --- change_log.txt | 3 +++ libs/Autoloader.php | 35 +++++++++-------------------------- 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/change_log.txt b/change_log.txt index 216b2cbc..603b5052 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@  ===== 3.1.30-dev ===== (xx.xx.xx) + 02.03.2016 + - revert autoloader optimizations because of unexplainable warning when using plugins https://github.com/smarty-php/smarty/issues/199 + 01.03.2016 - bugfix template objects must be cached on $smarty->fetch('foo.tpl) calls incase the template is fetched multiple times (forum topic 25909) diff --git a/libs/Autoloader.php b/libs/Autoloader.php index c713ac61..35db883f 100644 --- a/libs/Autoloader.php +++ b/libs/Autoloader.php @@ -90,34 +90,17 @@ class Smarty_Autoloader public static function autoload($class) { $_class = strtolower($class); + if (strpos($_class, 'smarty') !== 0) { + return; + } $file = self::$SMARTY_SYSPLUGINS_DIR . $_class . '.php'; - if (strpos($_class, 'smarty_internal_') === 0) { - if (strpos($_class, 'smarty_internal_compile_') === 0) { - if (is_file($file)) { - require $file; - } - return; - } - @include $file; - return; - } - if (preg_match('/^(smarty_(((template_(source|config|cache|compiled|resource_base))|((cached|compiled)?resource)|(variable|security)))|(smarty(bc)?)$)/', - $_class, $match)) { - if (!empty($match[ 3 ])) { - @include $file; - return; - } elseif (!empty($match[ 9 ]) && isset(self::$rootClasses[ $_class ])) { - $file = self::$rootClasses[ $_class ]; - require $file; - return; - } - } - if (0 !== strpos($_class, 'smarty')) { - return; - } if (is_file($file)) { - require $file; - return; + include $file; + } else if (isset(self::$rootClasses[ $_class ])) { + $file = self::$SMARTY_SYSPLUGINS_DIR . self::$rootClasses[ $_class ] . '.php'; + if (is_file($file)) { + include $file; + } } return; }