Re: Re: [PHP-DEV] Changes between 5.1.1 & 5.1.2-dev breaks PHP - Smartyplugin
"messju mohr" <[email protected]> Fri, 23 Dec 2005 16:29:45 +0100
| Newsgroups | gmane.comp.php.smarty.devel |
|---|---|
| Message-ID | <20051223152944.GA5967@dune> |
Hi, now that 5.1.2RC1 is out the door i have written a fix to this (patch against cvs HEAD is attached). if you want to help, please test it. greetings messju On Tue, Dec 20, 2005 at 05:16:35PM -0000, Holografix wrote: > Hi > I agree 100% with you. Lesson is learned. > Sorry for any incovenience. > > best regards > holo > > Merry "xxxxxxxmas" and a happy new year ;) > > ""messju mohr"" <[email protected]> escreveu na mensagem > news:20051220003352.GG15924@dune... > > On Mon, Dec 19, 2005 at 10:49:55PM -0000, Holografix wrote: > >> Hi > >> I was thinking the error was in PHP changes between 5.1.1 and 5.1.2-dev. > >> Is it a "hard" bug that needs much work? > > > > no, AFAICT it's just two places in the compiler where bad code is > > generated that is affected by this late change in php-5.1.x. it > > shouldn't be hard to fix. > > > > I was just too busy recently with other stuff and had not time to > > investigate+test this any further. > > > > regardless of this concrete issue it is a principle question if we > > should keep up with incompatibilities to dev versions and react early > > on things like this. I think not. If the problem persists in an RC1 > > (or mabye, but arguable, in a beta1) then we should get busy. > > > > in this particular case it may be very likely that the problem will > > stay until 5.1.2 is final but I've seen other cases where Smarty > > temporarily didn't work with -dev but was quite fine with the next > > RC. in such a case It would be wasted resources to "fix" it and would > > also be an unnecessary source of new errors to change it. you know you > > can't rely on dev-versions, that's why this one doesn't have a top > > priority. > > > > greetings > > messju (aka xxxxxxx :) > > > >> Best regards > >> holo > >> > >> > >> ""messju mohr"" <[email protected]> escreveu na mensagem > >> news:20051216211622.GA26104@dune... > >> > On Fri, Dec 16, 2005 at 09:43:59PM +0100, messju mohr wrote: > >> >> > >> >> I filed a more appropriate bug-report: > >> >> http://bugs.php.net/bug.php?id=35715 > >> >> > >> >> But I expect it to be marked as bogus very soon. > >> >> So no Smarty with php-5.1.2, sorry :( > >> > > >> > oh: http://marc.theaimsgroup.com/?l=php-dev&m=113476555724167&w=2 > >> > proves me wrong. so this code was broken since 2.6.0-RC1 and it *is* a > >> > Smarty bug. > >> > > >> > > >> >> On Fri, Dec 16, 2005 at 07:02:07PM -0000, Holografix wrote: > >> >> > Hi > >> >> > I've been in IRC #smarty channel and this is what i've got: > >> >> > <xxxx> you are using a dev-version off php on bother us with moronic > >> >> > userland bugs? > >> >> > <xxxx> bye. > >> >> > > >> >> > I just switch php versions from 5.1.1 to 5.1.2-dev and stop/start > >> >> > apache > >> >> > (windows). The php.ini and the extensions loaded are the same. > >> >> > The script, the plugin and the template are the same too. > >> >> > With php 5.1.1 I get the 16 images and no E_STRICT errors. With php > >> >> > 5.1.2-dev i get a blank page and those 3 errors. > >> >> > Could this be something like one problem that break foreach sometime > >> >> > ago? > >> >> > > >> >> > Best regards > >> >> > > >> >> > > >> >> > > >> >> > "Antony Dovgal" <[email protected]> escreveu na mensagem > >> >> > news:[email protected]... > >> >> > > Please report this to [email protected] > >> >> > > > >> >> > > On 16.12.2005 20:12, Holografix wrote: > >> >> > >> Hello > >> >> > >> This works fine with 5.1.1 > >> >> > >> > >> >> > >> PHP > >> >> > >> > >> >> > >> include '/wwwroot/lib/smarty/Smarty.class.php'; > >> >> > >> > >> >> > >> $tpl = new Smarty; > >> >> > >> $tpl->plugins_dir = array('/wwwroot/lib/smarty/plugins', > >> >> > >> '/wwwroot/home/testes/plugins'); > >> >> > >> $tpl->force_compile = true; > >> >> > >> > >> >> > >> $link = mysql_connect('localhost', 'xxxxx', 'yyyyy'); > >> >> > >> mysql_select_db('dbteste'); > >> >> > >> > >> >> > >> $res = mysql_query('SELECT * FROM Photos ORDER BY PhotoID'); > >> >> > >> while ($row = mysql_fetch_assoc($res)) { > >> >> > >> $rows[] = $row; > >> >> > >> } > >> >> > >> > >> >> > >> $tpl->assign("images", $rows); > >> >> > >> $tpl->display("table2.tpl"); > >> >> > >> > >> >> > >> Template > >> >> > >> <html> > >> >> > >> <body> > >> >> > >> <h1>Test</h1> > >> >> > >> {table_foreach from=$images item=image cols=4 rows=4} > >> >> > >> <img src="{$image.Photo}" /> > >> >> > >> {/table_foreach} > >> >> > >> </body> > >> >> > >> </html> > >> >> > >> > >> >> > >> The plugin is table_foreach, a bit long to copy & paste here > >> >> > >> http://smarty.incutio.com/?page=table_foreach > >> >> > >> > >> >> > >> Something change between 5.1.1 release and today 5.1.2-dev > >> >> > >> snapshot. > >> >> > >> > >> >> > >> I am getting this errors in my php error log file > >> >> > >> > >> >> > >> [16-Dec-2005 17:05:32] PHP Strict Standards: Only variables > >> >> > >> should > >> >> > >> be > >> >> > >> passed by reference in > >> >> > >> C:\wwwroot\lib\smarty\Smarty_Compiler.class.php on > >> >> > >> line 729 > >> >> > >> [16-Dec-2005 17:05:32] PHP Strict Standards: Only variables > >> >> > >> should > >> >> > >> be > >> >> > >> passed by reference in > >> >> > >> C:\wwwroot\home\tests\templates_c\%%72^721^721E602F%%table2.tpl.php > >> >> > >> on > >> >> > >> line 8 > >> >> > >> [16-Dec-2005 17:05:32] PHP Strict Standards: Only variables > >> >> > >> should > >> >> > >> be > >> >> > >> passed by reference in > >> >> > >> C:\wwwroot\home\tests\templates_c\%%72^721^721E602F%%table2.tpl.php > >> >> > >> on > >> >> > >> line 11 > >> >> > >> > >> >> > >> LINE 729 - Smarty_Compiler.class.php > >> >> > >> $arg_list = $this->_compile_arg_list('block', $tag_command, > >> >> > >> $attrs, > >> >> > >> $_cache_attrs=''); > >> >> > >> > >> >> > >> LINE 8 - %%72^721^721E602F%%table2.tpl.php > >> >> > >> <?php $this->_tag_stack[] = array('table_foreach', array('from' > >> >> > >> => > >> >> > >> $this->_tpl_vars['images'],'item' => 'image','cols' => 4,'rows' > >> >> > >> => > >> >> > >> 4)); > >> >> > >> smarty_block_table_foreach($this->_tag_stack[count($this->_tag_stack)-1][1], > >> >> > >> null, $this, $_block_repeat=true);while ($_block_repeat) { > >> >> > >> ob_start(); ?> > >> >> > >> > >> >> > >> LINE 11 - %%72^721^721E602F%%table2.tpl.php > >> >> > >> <?php $_block_content = ob_get_contents(); ob_end_clean(); echo > >> >> > >> smarty_block_table_foreach($this->_tag_stack[count($this->_tag_stack)-1][1], > >> >> > >> $_block_content, $this, $_block_repeat=false); } > >> >> > >> array_pop($this->_tag_stack); ?> > >> >> > >> > >> >> > >> Best regards > >> >> > >> > >> >> > > > >> >> > > > >> >> > > -- > >> >> > > Wbr, Antony Dovgal > >> >> > > >> >> > -- > >> >> > PHP Internals - PHP Runtime Development Mailing List > >> >> > To unsubscribe, visit: http://www.php.net/unsub.php > >> >> > >> >> -- > >> >> Smarty Development Mailing List (http://smarty.php.net/) > >> >> To unsubscribe, visit: http://www.php.net/unsub.php > >> > >> > >> > >> -- > >> Smarty Development Mailing List (http://smarty.php.net/) > >> To unsubscribe, visit: http://www.php.net/unsub.php > > -- > Smarty Development Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- Smarty Development Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Smarty_Compiler.class-fix_args_by_ref.diff.txt
(text/plain, 3.9 KB)
Index: Smarty_Compiler.class.php
===================================================================
RCS file: /repository/smarty/libs/Smarty_Compiler.class.php,v
retrieving revision 1.375
diff -u -u -r1.375 Smarty_Compiler.class.php
--- Smarty_Compiler.class.php 21 Dec 2005 18:09:23 -0000 1.375
+++ Smarty_Compiler.class.php 23 Dec 2005 15:28:51 -0000
@@ -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 {