diff --git a/libs/sysplugins/smarty_internal_cacheresource_file.php b/libs/sysplugins/smarty_internal_cacheresource_file.php index 1f38b719..64d02dfe 100644 --- a/libs/sysplugins/smarty_internal_cacheresource_file.php +++ b/libs/sysplugins/smarty_internal_cacheresource_file.php @@ -97,7 +97,7 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource */ $_smarty_tpl = $_template; $_template->cached->valid = false; - if ($update && strpos(phpversion(), 'hhvm') !== false) { + if ($update && defined('HHVM_VERSION')) { return $_template->smarty->ext->_hhvm->includeHhvm($_template, $_template->cached->filepath); } else { return @include $_template->cached->filepath; diff --git a/libs/sysplugins/smarty_internal_compile_function.php b/libs/sysplugins/smarty_internal_compile_function.php index f1d28dcf..26804b6a 100644 --- a/libs/sysplugins/smarty_internal_compile_function.php +++ b/libs/sysplugins/smarty_internal_compile_function.php @@ -151,7 +151,7 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode); $output = "template->compiled->nocache_hash}%%*/ \\\$value){\n"; - $output .= "if (\\\$_smarty_tpl->tpl_vars[\\\$key] === \\\$value) \\\$saved_tpl_vars[\\\$key] = \\\$value;\n}\n"; + $output .= "if (!isset(\\\$_smarty_tpl->tpl_vars[\\\$key]) || \\\$_smarty_tpl->tpl_vars[\\\$key] === \\\$value) \\\$saved_tpl_vars[\\\$key] = \\\$value;\n}\n"; $output .= "\\\$_smarty_tpl->tpl_vars = \\\$saved_tpl_vars;?>\n"; $output .= "/*/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/\";\n?>"; $output .= "template->compiled->nocache_hash}', \$_smarty_tpl->compiled->nocache_hash, ob_get_clean());\n"; @@ -173,7 +173,7 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase $compiler->parser->current_buffer->append_subtree($compiler->parser, new Smarty_Internal_ParseTree_Tag($compiler->parser, $output)); $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode); $output = " \$value){\n"; - $output .= "if (\$_smarty_tpl->tpl_vars[\$key] === \$value) \$saved_tpl_vars[\$key] = \$value;\n}\n"; + $output .= "if (!isset(\$_smarty_tpl->tpl_vars[\$key]) || \$_smarty_tpl->tpl_vars[\$key] === \$value) \$saved_tpl_vars[\$key] = \$value;\n}\n"; $output .= "\$_smarty_tpl->tpl_vars = \$saved_tpl_vars;\n}\n}\n"; $output .= "/*/ {$_funcName} */\n\n"; $output .= "?>\n"; diff --git a/libs/sysplugins/smarty_template_compiled.php b/libs/sysplugins/smarty_template_compiled.php index 1facc28f..e7710f85 100644 --- a/libs/sysplugins/smarty_template_compiled.php +++ b/libs/sysplugins/smarty_template_compiled.php @@ -169,7 +169,7 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base opcache_invalidate($_template->compiled->filepath); } $_smarty_tpl = $_template; - if (strpos(phpversion(), 'hhvm') !== false) { + if (defined('HHVM_VERSION')) { $_template->smarty->ext->_hhvm->includeHhvm($_template, $_template->compiled->filepath); } else { include($_template->compiled->filepath); diff --git a/libs/sysplugins/smarty_template_source.php b/libs/sysplugins/smarty_template_source.php index 4dddbc0e..be5b6280 100644 --- a/libs/sysplugins/smarty_template_source.php +++ b/libs/sysplugins/smarty_template_source.php @@ -157,9 +157,9 @@ class Smarty_Template_Source throw new SmartyException('Missing template name'); } // parse resource_name, load resource handler, identify unique resource name - if (preg_match('/^([A-Za-z0-9_\-]{2,})[:]/', $template_resource, $match)) { + if (preg_match('/^([A-Za-z0-9_\-]{2,})[:]([\s\S]*)$/', $template_resource, $match)) { $type = $match[1]; - $name = substr($template_resource, strlen($match[0])); + $name = $match[2]; } else { // no resource given, use default // or single character before the colon is not a resource type, but part of the filepath