summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruwetews <uwe.tews@googlemail.com>2016-08-14 02:38:55 +0200
committeruwetews <uwe.tews@googlemail.com>2016-08-14 02:38:55 +0200
commit1b6d2a9375e83850f3c26030253da5667d86f06f (patch)
tree5836fc31a4bccadbd34d0601b68aef25639046f3
parentfee77dbfb844dd7f9d5986ae1d741ae39e7b2bd3 (diff)
downloadsmarty-1b6d2a9375e83850f3c26030253da5667d86f06f.tar.gz
smarty-1b6d2a9375e83850f3c26030253da5667d86f06f.tar.bz2
smarty-1b6d2a9375e83850f3c26030253da5667d86f06f.zip
- 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
-rw-r--r--change_log.txt2
-rw-r--r--libs/Smarty.class.php2
-rw-r--r--libs/sysplugins/smarty_internal_extension_handler.php19
-rw-r--r--libs/sysplugins/smarty_internal_undefined.php33
4 files changed, 43 insertions, 13 deletions
diff --git a/change_log.txt b/change_log.txt
index aa19638c..cb7a7347 100644
--- a/change_log.txt
+++ b/change_log.txt
@@ -1,6 +1,8 @@
===== 3.1.31-dev ===== (xx.xx.xx)
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 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)
diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php
index b6ba2685..7702e02e 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/2';
+ const SMARTY_VERSION = '3.1.31-dev/3';
/**
* define variable scopes
diff --git a/libs/sysplugins/smarty_internal_extension_handler.php b/libs/sysplugins/smarty_internal_extension_handler.php
index edeb3958..bda8e82a 100644
--- a/libs/sysplugins/smarty_internal_extension_handler.php
+++ b/libs/sysplugins/smarty_internal_extension_handler.php
@@ -10,15 +10,20 @@
* @subpackage PluginsInternal
* @author Uwe Tews
*
- * @property Smarty_Internal_Runtime_TplFunction $_tplFunction
- * @property Smarty_Internal_Runtime_Foreach $_foreach
- * @property Smarty_Internal_Runtime_WriteFile $_writeFile
+ * Runtime extensions
+ * @property Smarty_Internal_Runtime_CacheModify $_cacheModify
+ * @property Smarty_Internal_Runtime_Capture $_capture
* @property Smarty_Internal_Runtime_CodeFrame $_codeFrame
* @property Smarty_Internal_Runtime_FilterHandler $_filterHandler
+ * @property Smarty_Internal_Runtime_Foreach $_foreach
* @property Smarty_Internal_Runtime_GetIncludePath $_getIncludePath
- * @property Smarty_Internal_Runtime_UpdateScope $_updateScope
- * @property Smarty_Internal_Runtime_CacheModify $_cacheModify
+ * @property Smarty_Internal_Runtime_Make_Nocache $_make_nocache
* @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_Append $append
* @property Smarty_Internal_Method_AppendByRef $appendByRef
@@ -64,6 +69,7 @@ class Smarty_Internal_Extension_Handler
if (!isset($smarty->ext->$name)) {
$class = 'Smarty_Internal_Method_' . ucfirst($name);
if (preg_match('/^(set|get)([A-Z].*)$/', $name, $match)) {
+ $pn = '';
if (!isset($this->_property_info[ $prop = $match[ 2 ] ])) {
// convert camel case to underscored name
$this->resolvedProperties[ $prop ] = $pn = strtolower(join('_',
@@ -127,6 +133,9 @@ class Smarty_Internal_Extension_Handler
} else {
$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();
}
diff --git a/libs/sysplugins/smarty_internal_undefined.php b/libs/sysplugins/smarty_internal_undefined.php
index 23563e05..d6f4bf62 100644
--- a/libs/sysplugins/smarty_internal_undefined.php
+++ b/libs/sysplugins/smarty_internal_undefined.php
@@ -1,9 +1,9 @@
<?php
/**
- * Smarty Method AppendByRef
+ * Smarty Internal Undefined
*
- * Smarty::appendByRef() method
+ * Class to handle undefined method calls or calls to obsolete runtime extensions
*
* @package Smarty
* @subpackage PluginsInternal
@@ -13,15 +13,30 @@ class Smarty_Internal_Undefined
{
/**
- * This function is executed automatically when a compiled or cached template file is included
- * - Decode saved properties from compiled template and cache files
- * - Check if compiled or cache file is valid
+ * Name of undefined extension class
+ *
+ * @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 array $properties special template properties
* @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)
{
@@ -44,6 +59,10 @@ class Smarty_Internal_Undefined
*/
public function __call($name, $args)
{
- throw new SmartyException(get_class($args[ 0 ]) . "->{$name}() undefined method");
+ if (isset($this->class)) {
+ throw new SmartyException("undefined extension class '{$this->class}'");
+ } else {
+ throw new SmartyException(get_class($args[ 0 ]) . "->{$name}() undefined method");
+ }
}
} \ No newline at end of file