diff --git a/change_log.txt b/change_log.txt index 83e93baed..1fa7427b5 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,6 +1,7 @@ ===== 3.1.31-dev ===== (xx.xx.xx) 20.08-2016 - bugfix {config_load ... scope="global"} shall not throw an arror but fallback to scope="smarty" https://github.com/smarty-php/smarty/issues/274 + - bugfix {make_nocache} failed when using composer autoloader https://github.com/smarty-php/smarty/issues/275 14.08.2016 - bugfix $smarty_>debugging = true; did E_NOTICE messages when {eval} tag was used https://github.com/smarty-php/smarty/issues/266 diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 393990104..f8ccae945 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -121,7 +121,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.31-dev/5'; + const SMARTY_VERSION = '3.1.31-dev/6'; /** * define variable scopes diff --git a/libs/sysplugins/smarty_internal_extension_handler.php b/libs/sysplugins/smarty_internal_extension_handler.php index bda8e82a4..9368b0e2f 100644 --- a/libs/sysplugins/smarty_internal_extension_handler.php +++ b/libs/sysplugins/smarty_internal_extension_handler.php @@ -67,7 +67,7 @@ public function _callExternalMethod(Smarty_Internal_Data $data, $name, $args) /* @var Smarty $data ->smarty */ $smarty = isset($data->smarty) ? $data->smarty : $data; if (!isset($smarty->ext->$name)) { - $class = 'Smarty_Internal_Method_' . ucfirst($name); + $class = 'Smarty_Internal_Method_' . $this->upperCase($name); if (preg_match('/^(set|get)([A-Z].*)$/', $name, $match)) { $pn = ''; if (!isset($this->_property_info[ $prop = $match[ 2 ] ])) { @@ -104,6 +104,19 @@ public function _callExternalMethod(Smarty_Internal_Data $data, $name, $args) return call_user_func_array(array(new Smarty_Internal_Undefined(), $name), $args); } + /** + * Make first character of name parts upper case + * + * @param string $name + * + * @return string + */ + public function upperCase($name) { + $_name = explode('_', $name); + $_name = array_map('ucfirst', $_name); + return implode('_', $_name); + } + /** * set extension property * @@ -129,9 +142,9 @@ public function __get($property_name) { // object properties of runtime template extensions will start with '_' if ($property_name[ 0 ] == '_') { - $class = 'Smarty_Internal_Runtime_' . ucfirst(substr($property_name, 1)); + $class = 'Smarty_Internal_Runtime' . $this->upperCase($property_name); } else { - $class = 'Smarty_Internal_Method_' . ucfirst($property_name); + $class = 'Smarty_Internal_Method_' . $this->upperCase($property_name); } if (!class_exists($class)) { return $this->$property_name = new Smarty_Internal_Undefined($class);