From:             hans at velum dot net
Operating system: Linux (Debian)
PHP version:      5.0.0b1 (beta1)
PHP Bug Type:     Zend Engine 2 problem
Bug description:  Variable method names have become less flexible

Description:
------------
Smarty uses a rather complex variable method name replacement system.  In
the "compiled" Smarty templates there is code like this:

  $this->_plugins['function']['assign'][0](/* params */)

Which works fine in PHP4, but PHP5 issues a fatal error:

  "Fatal error: Method name must be a string"

Is this a PHP5 bug or an abuse of PHP syntax (and therefore a Smarty bug)?

Reproduce code:
---------------
A Smarty compiled template:

<?php $this->_load_plugins(array(
array('function', 'assign', 'sql/db-init/Control.tpl', 1, false),));
?><?php echo $this->_plugins['function']['assign'][0](array('var' =>
'fname','value' =>
"sql/db-init/".$this->_tpl_vars['targetDatabase']."/createdb.tpl"), $this)
; ?>

<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include($this->_tpl_vars['fname'], array());
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
~

Expected result:
----------------
No error.

Actual result:
--------------
Fatal error: Method name must be a string in
templates_c/%%-16/%%-1662958972/Control.tpl.php

-- 
Edit bug report at http://bugs.php.net/?id=24939&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=24939&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=24939&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=24939&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24939&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24939&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24939&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24939&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24939&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24939&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24939&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24939&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24939&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24939&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24939&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24939&r=gnused

Reply via email to