Skip to content

Modifier called like a function compiled to modifier name, not function callback #1100

@rudiedirkx

Description

@rudiedirkx

Smarty 4.5.5

Is this a bug or a very strange feature? If I define a modifier:

$this->smarty->registerPlugin('modifier', 'kprint_r_out', trim(...));

and call it like:

{kprint_r_out($myVar)}

it will compile into

<?php echo kprint_r_out($_smarty_tpl->tpl_vars['myVar']->value);?>

even though kprint_r_out is only the name of the function, not the function itself (but kprint_r_out() does exist, otherwise it won't compile). The function (trim in this case) isn't used at all...

I like calling functions like function, but this is too weird. If it's intentional, it shouldn't be defined as a modifier with mandatory callback (that's not used).

Or am I abusing another Smarty functionality somehow?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions