fixed bug with passing $smarty as reference in Smarty.compiler.class

quoted "<?php ... ?>" in comment to dis-annoy syntax-highlighting of a certain editor
This commit is contained in:
messju
2003-04-18 10:03:09 +00:00
parent 76a3ebd1a8
commit 2ba21fd1e1
3 changed files with 9 additions and 5 deletions

1
NEWS
View File

@@ -1,3 +1,4 @@
- fixed bug with passing $smarty as reference in Smarty.compiler.class (messju)
- corrected output with {strip} and PHP tag newlines (Monte) - corrected output with {strip} and PHP tag newlines (Monte)
- added possibility to register function-callbacks as "array(&$obj, 'method)" - added possibility to register function-callbacks as "array(&$obj, 'method)"
this affects register_function(), -block, -compiler_function, -modifier, this affects register_function(), -block, -compiler_function, -modifier,

View File

@@ -186,7 +186,7 @@ class Smarty
var $cache_modified_check = false; var $cache_modified_check = false;
/** /**
* This determines how Smarty handles <?php ?> tags in templates. * This determines how Smarty handles "<?php ... ?>" tags in templates.
* possible values: * possible values:
* <ul> * <ul>
* <li>SMARTY_PHP_PASSTHRU -> print tags as plain text</li> * <li>SMARTY_PHP_PASSTHRU -> print tags as plain text</li>

View File

@@ -229,7 +229,8 @@ class Smarty_Compiler extends Smarty {
foreach ($this->_plugins['prefilter'] as $filter_name => $prefilter) { foreach ($this->_plugins['prefilter'] as $filter_name => $prefilter) {
if ($prefilter === false) continue; if ($prefilter === false) continue;
if ($prefilter[3] || $this->_plugin_implementation_exists($prefilter[0])) { if ($prefilter[3] || $this->_plugin_implementation_exists($prefilter[0])) {
$template_source = call_user_func($prefilter[0], $template_source, $this); $template_source = call_user_func_array($prefilter[0],
array($template_source, &$this));
$this->_plugins['prefilter'][$filter_name][3] = true; $this->_plugins['prefilter'][$filter_name][3] = true;
} else { } else {
$this->_trigger_fatal_error("[plugin] prefilter '$filter_name' is not implemented"); $this->_trigger_fatal_error("[plugin] prefilter '$filter_name' is not implemented");
@@ -336,7 +337,8 @@ class Smarty_Compiler extends Smarty {
foreach ($this->_plugins['postfilter'] as $filter_name => $postfilter) { foreach ($this->_plugins['postfilter'] as $filter_name => $postfilter) {
if ($postfilter === false) continue; if ($postfilter === false) continue;
if ($postfilter[3] || $this->_plugin_implementation_exists($postfilter[0])) { if ($postfilter[3] || $this->_plugin_implementation_exists($postfilter[0])) {
$template_compiled = call_user_func($postfilter[0], $template_compiled, $this); $template_compiled = call_user_func_array($postfilter[0],
array($template_compiled, &$this));
$this->_plugins['postfilter'][$filter_name][3] = true; $this->_plugins['postfilter'][$filter_name][3] = true;
} else { } else {
$this->_trigger_fatal_error("Smarty plugin error: postfilter '$filter_name' is not implemented"); $this->_trigger_fatal_error("Smarty plugin error: postfilter '$filter_name' is not implemented");
@@ -559,7 +561,8 @@ class Smarty_Compiler extends Smarty {
*/ */
if ($found) { if ($found) {
if ($have_function) { if ($have_function) {
$output = '<?php ' . call_user_func($plugin_func, $tag_args, $this) . ' ?>'; $output = '<?php ' . call_user_func_array($plugin_func,
array($tag_args, &$this)) . ' ?>';
} else { } else {
$this->_syntax_error($message, E_USER_WARNING, __FILE__, __LINE__); $this->_syntax_error($message, E_USER_WARNING, __FILE__, __LINE__);
} }