Changes between 5.1.1 & 5.1.2-dev breaks PHP - Smarty plugin

php.internals

Holografix

20 years ago
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

Antony Dovgal

20 years ago
Please report this to smarty-dev@lists.php.net 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

Holografix

20 years ago
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" <antony@zend.com> escreveu na mensagem news:43A2FE35.1090609@zend.com...

Jani Taskinen

20 years ago
I think it was just change of E_NOTICE to E_STRICT? :) --Jani On Fri, 16 Dec 2005, 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 > >
-- Give me your money at @ <http://pecl.php.net/wishlist.php/sniper> Donating money may make me happier and friendlier for a limited period! Death to all 4 letter abbreviations starting with P!

boots

20 years ago
Hi. It seems to me that Smarty is not at fault. For example, one of the reported issues is:
> > $arg_list = $this->_compile_arg_list('block', $tag_command, $attrs, > > $_cache_attrs='');
Which calls: function _compile_arg_list($type, $name, $attrs, &$cache_code) { Yet is apparently generating:
> > [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
Clearly the passed parameter is the variable, $_cache_attrs. So what's with this new strictness? It was certainly not a notice previously. best, xo boots --- Jani Taskinen <sniper@iki.fi> wrote:
> > I think it was just change of E_NOTICE to E_STRICT? :) > > --Jani > > > On Fri, 16 Dec 2005, 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
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

Michael Wallner

20 years ago
boots wrote:
> Hi. It seems to me that Smarty is not at fault. For example, one of the > reported issues is: > >>> $arg_list = $this->_compile_arg_list('block', $tag_command, $attrs, >>> $_cache_attrs=''); > > Which calls: > > function _compile_arg_list($type, $name, $attrs, &$cache_code) { > > Yet is apparently generating: > >>> [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 > > Clearly the passed parameter is the variable, $_cache_attrs. So what's with > this new strictness? It was certainly not a notice previously.
Which actually is an expression. http://php.net/manual/en/language.references.pass.php Regards,
-- Michael - <mike(@)php.net> http://dev.iworks.at/ext-http/http-functions.html.gz

boots

20 years ago
--- Michael Wallner <mike@php.net> wrote:
> boots wrote: > > Hi. It seems to me that Smarty is not at fault. For example, one of the > > reported issues is: > > > >>> $arg_list = $this->_compile_arg_list('block', $tag_command, $attrs, > >>> $_cache_attrs=''); > > > > Which calls: > > > > function _compile_arg_list($type, $name, $attrs, &$cache_code) { > > > > Yet is apparently generating: > > > >>> [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 > > > > Clearly the passed parameter is the variable, $_cache_attrs. So what's with > > this new strictness? It was certainly not a notice previously. > > Which actually is an expression. > http://php.net/manual/en/language.references.pass.php
Ah, thanks. Sorry for the noise. xo boots
> Regards, > -- > Michael - <mike(@)php.net> > http://dev.iworks.at/ext-http/http-functions.html.gz
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com