- bugfix Class 'Smarty_Internal_Runtime_ValidateCompiled' not found when upgrading from some older Smarty versions with existing

compiled or cached template files https://github.com/smarty-php/smarty/issues/269
This commit is contained in:
uwetews
2016-08-14 02:38:55 +02:00
parent fee77dbfb8
commit 1b6d2a9375
4 changed files with 43 additions and 13 deletions

View File

@@ -1,6 +1,8 @@
===== 3.1.31-dev ===== (xx.xx.xx) ===== 3.1.31-dev ===== (xx.xx.xx)
14.08.2016 14.08.2016
- bugfix $smarty_>debugging = true; did E_NOTICE messages when {eval} tag was used https://github.com/smarty-php/smarty/issues/266 - bugfix $smarty_>debugging = true; did E_NOTICE messages when {eval} tag was used https://github.com/smarty-php/smarty/issues/266
- bugfix Class 'Smarty_Internal_Runtime_ValidateCompiled' not found when upgrading from some older Smarty versions with existing
compiled or cached template files https://github.com/smarty-php/smarty/issues/269
===== 3.1.30 ===== (07.08.2016) ===== 3.1.30 ===== (07.08.2016)

View File

@@ -121,7 +121,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/** /**
* smarty version * smarty version
*/ */
const SMARTY_VERSION = '3.1.31-dev/2'; const SMARTY_VERSION = '3.1.31-dev/3';
/** /**
* define variable scopes * define variable scopes

View File

@@ -10,15 +10,20 @@
* @subpackage PluginsInternal * @subpackage PluginsInternal
* @author Uwe Tews * @author Uwe Tews
* *
* @property Smarty_Internal_Runtime_TplFunction $_tplFunction * Runtime extensions
* @property Smarty_Internal_Runtime_Foreach $_foreach * @property Smarty_Internal_Runtime_CacheModify $_cacheModify
* @property Smarty_Internal_Runtime_WriteFile $_writeFile * @property Smarty_Internal_Runtime_Capture $_capture
* @property Smarty_Internal_Runtime_CodeFrame $_codeFrame * @property Smarty_Internal_Runtime_CodeFrame $_codeFrame
* @property Smarty_Internal_Runtime_FilterHandler $_filterHandler * @property Smarty_Internal_Runtime_FilterHandler $_filterHandler
* @property Smarty_Internal_Runtime_Foreach $_foreach
* @property Smarty_Internal_Runtime_GetIncludePath $_getIncludePath * @property Smarty_Internal_Runtime_GetIncludePath $_getIncludePath
* @property Smarty_Internal_Runtime_UpdateScope $_updateScope * @property Smarty_Internal_Runtime_Make_Nocache $_make_nocache
* @property Smarty_Internal_Runtime_CacheModify $_cacheModify
* @property Smarty_Internal_Runtime_UpdateCache $_updateCache * @property Smarty_Internal_Runtime_UpdateCache $_updateCache
* @property Smarty_Internal_Runtime_UpdateScope $_updateScope
* @property Smarty_Internal_Runtime_TplFunction $_tplFunction
* @property Smarty_Internal_Runtime_WriteFile $_writeFile
*
* Method extensions
* @property Smarty_Internal_Method_GetTemplateVars $getTemplateVars * @property Smarty_Internal_Method_GetTemplateVars $getTemplateVars
* @property Smarty_Internal_Method_Append $append * @property Smarty_Internal_Method_Append $append
* @property Smarty_Internal_Method_AppendByRef $appendByRef * @property Smarty_Internal_Method_AppendByRef $appendByRef
@@ -64,6 +69,7 @@ class Smarty_Internal_Extension_Handler
if (!isset($smarty->ext->$name)) { if (!isset($smarty->ext->$name)) {
$class = 'Smarty_Internal_Method_' . ucfirst($name); $class = 'Smarty_Internal_Method_' . ucfirst($name);
if (preg_match('/^(set|get)([A-Z].*)$/', $name, $match)) { if (preg_match('/^(set|get)([A-Z].*)$/', $name, $match)) {
$pn = '';
if (!isset($this->_property_info[ $prop = $match[ 2 ] ])) { if (!isset($this->_property_info[ $prop = $match[ 2 ] ])) {
// convert camel case to underscored name // convert camel case to underscored name
$this->resolvedProperties[ $prop ] = $pn = strtolower(join('_', $this->resolvedProperties[ $prop ] = $pn = strtolower(join('_',
@@ -127,6 +133,9 @@ class Smarty_Internal_Extension_Handler
} else { } else {
$class = 'Smarty_Internal_Method_' . ucfirst($property_name); $class = 'Smarty_Internal_Method_' . ucfirst($property_name);
} }
if (!class_exists($class)) {
return $this->$property_name = new Smarty_Internal_Undefined($class);
}
return $this->$property_name = new $class(); return $this->$property_name = new $class();
} }

View File

@@ -1,9 +1,9 @@
<?php <?php
/** /**
* Smarty Method AppendByRef * Smarty Internal Undefined
* *
* Smarty::appendByRef() method * Class to handle undefined method calls or calls to obsolete runtime extensions
* *
* @package Smarty * @package Smarty
* @subpackage PluginsInternal * @subpackage PluginsInternal
@@ -13,15 +13,30 @@ class Smarty_Internal_Undefined
{ {
/** /**
* This function is executed automatically when a compiled or cached template file is included * Name of undefined extension class
* - Decode saved properties from compiled template and cache files *
* - Check if compiled or cache file is valid * @var string|null
*/
public $class = null;
/**
* Smarty_Internal_Undefined constructor.
*
* @param null|string $class name of undefined extension class
*/
public function __construct($class = null)
{
$this->class = $class;
}
/**
* Wrapper for obsolete class Smarty_Internal_Runtime_ValidateCompiled
* *
* @param \Smarty_Internal_Template $tpl * @param \Smarty_Internal_Template $tpl
* @param array $properties special template properties * @param array $properties special template properties
* @param bool $cache flag if called from cache file * @param bool $cache flag if called from cache file
* *
* @return bool flag if compiled or cache file is valid * @return bool false
*/ */
public function decodeProperties(Smarty_Internal_Template $tpl, $properties, $cache = false) public function decodeProperties(Smarty_Internal_Template $tpl, $properties, $cache = false)
{ {
@@ -44,6 +59,10 @@ class Smarty_Internal_Undefined
*/ */
public function __call($name, $args) public function __call($name, $args)
{ {
if (isset($this->class)) {
throw new SmartyException("undefined extension class '{$this->class}'");
} else {
throw new SmartyException(get_class($args[ 0 ]) . "->{$name}() undefined method"); throw new SmartyException(get_class($args[ 0 ]) . "->{$name}() undefined method");
} }
}
} }