Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Problem using Smarty 2.5.0 and PHP-4.3.3

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
riba
Smarty n00b


Joined: 10 Nov 2003
Posts: 2

PostPosted: Mon Nov 10, 2003 3:32 pm    Post subject: Problem using Smarty 2.5.0 and PHP-4.3.3 Reply with quote

With PHP 4.3.3 when I try to get the Smarty-2.5.0/demo/index.php page, I receive the following error:
(everything works well with PHP-4.2.3)
Code:
Fatal error: Method name must be a string in /data/download/php/Smarty-2.5.0/demo/templates_c/%%-13/%%-135052920/header.tpl.php on line 6

Inside the compiled page (header.tpl.php) the problem was this line:
Code:
<?php echo $this->_plugins['function']['popup_init'][0](array('src' => "/javascripts/overlib.js"), $this) ; ?>

Calling a function like this doesn't work with PHP-4.3.3
Another way, that let smarty work is:
Code:
<?php $f = $this->_plugins['function']['popup_init'][0]; echo $f(array('src' => "/javascripts/overlib.js"), $this) ; ?>

So, I quickly hack the Smarty_Compiler.class.php file
function: _compile_custom_tag($tag_command, $tag_args, $tag_modifier)
to replace the following code:
Code:
$return = "\$this->_plugins['function']['$tag_command'][0](array(".implode(',', (array)$arg_list)."), \$this)";
if($tag_modifier != '') {
  $this->_parse_modifiers($return, $tag_modifier);
}
return '<?php echo ' . $return . " ; ?>\n";

by:
Code:
$r = "\$f = \$this->_plugins['function']['$tag_command'][0]; echo \$f(array(".implode(',', (array)$arg_list)."), \$this)";
if($tag_modifier != '') {
  $this->_parse_modifiers($r, $tag_modifier);
}
return '<? '.$r."; ?>\n";


After, this operation, Smarty seems to work well.

I'am not sure if the hack break something, I discover Smarty since 20mn Smile

So, If a core developper can examine the hack, see if it's correct and
perhaps integrate it in smaty source.

Thanks,
Olivier.
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Mon Nov 10, 2003 3:55 pm    Post subject: Reply with quote

i have no problems with Smarty-2.5.0 and php-4.3.3 . the error-message you show above looks like php5.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
riba
Smarty n00b


Joined: 10 Nov 2003
Posts: 2

PostPosted: Mon Nov 10, 2003 3:59 pm    Post subject: Reply with quote

Arff, I lose !
It's PHP5, so ... Smile
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Mon Nov 10, 2003 4:13 pm    Post subject: Reply with quote

if you don't bother running beta-code like php5, try Smarty-2.6.0-RC2. except of the (yet rarely used) non-cacheable-plugin's-output-stuff it should work fine with php5.

a solution for the non-cacheable-plugins is still pending, see this thread
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP