cvs: smarty / NEWS /libs Smarty_Compiler.class.php
[email protected] ("Messju Mohr") Sun, 15 Jan 2006 19:29:45 -0000
| Newsgroups | php.smarty.cvs |
|---|---|
| Message-ID | <cvsmessju1137353385@cvsserver> |
messju Sun Jan 15 19:29:45 2006 UTC
Modified files:
/smarty NEWS
/smarty/libs Smarty_Compiler.class.php
Log:
fixed use of references $cache_attrs and $repeat in Smarty_Compiler.
php does not allow to pass an assigned by reference to a function. since php-5.1.2
the reference to the lval gets lost when passing an assignment.
http://cvs.php.net/viewcvs.cgi/smarty/NEWS?r1=1.523&r2=1.524&diff_format=u
Index: smarty/NEWS
diff -u smarty/NEWS:1.523 smarty/NEWS:1.524
--- smarty/NEWS:1.523 Sat Dec 31 19:17:05 2005
+++ smarty/NEWS Sun Jan 15 19:29:45 2006
@@ -1,3 +1,5 @@
+ - fix improper use of references in the compiler handling cached
+ attributes and in compiled code handling block plugins (messju)
- make Smarty::_read_file() work on latest php (messju)
- fixed improper tokenization of certain inline math expressions (boots)
http://cvs.php.net/viewcvs.cgi/smarty/libs/Smarty_Compiler.class.php?r1=1.375&r2=1.376&diff_format=u
Index: smarty/libs/Smarty_Compiler.class.php
diff -u smarty/libs/Smarty_Compiler.class.php:1.375 smarty/libs/Smarty_Compiler.class.php:1.376
--- smarty/libs/Smarty_Compiler.class.php:1.375 Wed Dec 21 18:09:23 2005
+++ smarty/libs/Smarty_Compiler.class.php Sun Jan 15 19:29:45 2006
@@ -26,7 +26,7 @@
* @package Smarty
*/
-/* $Id: Smarty_Compiler.class.php,v 1.375 2005/12/21 18:09:23 boots Exp $ */
+/* $Id: Smarty_Compiler.class.php,v 1.376 2006/01/15 19:29:45 messju Exp $ */
/**
* Template compiling class
@@ -726,17 +726,18 @@
if ($start_tag) {
$output = '<?php ' . $this->_push_cacheable_state('block', $tag_command);
$attrs = $this->_parse_attrs($tag_args);
- $arg_list = $this->_compile_arg_list('block', $tag_command, $attrs, $_cache_attrs='');
+ $_cache_attrs='';
+ $arg_list = $this->_compile_arg_list('block', $tag_command, $attrs, $_cache_attrs);
$output .= "$_cache_attrs\$this->_tag_stack[] = array('$tag_command', array(".implode(',', $arg_list).')); ';
- $output .= $this->_compile_plugin_call('block', $tag_command).'($this->_tag_stack[count($this->_tag_stack)-1][1], null, $this, $_block_repeat=true);';
+ $output .= '$_block_repeat=true;' . $this->_compile_plugin_call('block', $tag_command).'($this->_tag_stack[count($this->_tag_stack)-1][1], null, $this, $_block_repeat);';
$output .= 'while ($_block_repeat) { ob_start(); ?>';
} else {
$output = '<?php $_block_content = ob_get_contents(); ob_end_clean(); ';
- $_out_tag_text = $this->_compile_plugin_call('block', $tag_command).'($this->_tag_stack[count($this->_tag_stack)-1][1], $_block_content, $this, $_block_repeat=false)';
+ $_out_tag_text = $this->_compile_plugin_call('block', $tag_command).'($this->_tag_stack[count($this->_tag_stack)-1][1], $_block_content, $this, $_block_repeat)';
if ($tag_modifier != '') {
$this->_parse_modifiers($_out_tag_text, $tag_modifier);
}
- $output .= 'echo '.$_out_tag_text.'; } ';
+ $output .= '$_block_repeat=false;echo ' . $_out_tag_text . '; } ';
$output .= " array_pop(\$this->_tag_stack); " . $this->_pop_cacheable_state('block', $tag_command) . '?>';
}
@@ -801,7 +802,8 @@
$_cacheable_state = $this->_push_cacheable_state('function', $tag_command);
$attrs = $this->_parse_attrs($tag_args);
- $arg_list = $this->_compile_arg_list('function', $tag_command, $attrs, $_cache_attrs='');
+ $_cache_attrs = '';
+ $arg_list = $this->_compile_arg_list('function', $tag_command, $attrs, $_cache_attrs);
$output = $this->_compile_plugin_call('function', $tag_command).'(array('.implode(',', $arg_list)."), \$this)";
if($tag_modifier != '') {
@@ -874,13 +876,13 @@
// block method
if ($start_tag) {
$prefix = "\$this->_tag_stack[] = array('$obj_comp', $args); ";
- $prefix .= "\$this->_reg_objects['$object'][0]->$obj_comp(\$this->_tag_stack[count(\$this->_tag_stack)-1][1], null, \$this, \$_block_repeat=true); ";
+ $prefix .= "\$_block_repeat=true; \$this->_reg_objects['$object'][0]->$obj_comp(\$this->_tag_stack[count(\$this->_tag_stack)-1][1], null, \$this, \$_block_repeat); ";
$prefix .= "while (\$_block_repeat) { ob_start();";
$return = null;
$postfix = '';
} else {
$prefix = "\$_obj_block_content = ob_get_contents(); ob_end_clean(); ";
- $return = "\$this->_reg_objects['$object'][0]->$obj_comp(\$this->_tag_stack[count(\$this->_tag_stack)-1][1], \$_obj_block_content, \$this, \$_block_repeat=false)";
+ $return = "\$_block_repeat=false; \$this->_reg_objects['$object'][0]->$obj_comp(\$this->_tag_stack[count(\$this->_tag_stack)-1][1], \$_obj_block_content, \$this, \$_block_repeat)";
$postfix = "} array_pop(\$this->_tag_stack);";
}
} else {