Skip to content

Commit

Permalink
- bugfix {make_nocache} failed when using composer autoloader #275
Browse files Browse the repository at this point in the history
  • Loading branch information
uwetews committed Aug 20, 2016
1 parent c39abdf commit be39cc0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion libs/Smarty.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 16 additions & 3 deletions libs/sysplugins/smarty_internal_extension_handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ] ])) {
Expand Down Expand Up @@ -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
*
Expand All @@ -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);
Expand Down

0 comments on commit be39cc0

Please sign in to comment.