Closed meesha81 closed 4 months ago
I have found it is propably similar to https://github.com/smarty-php/smarty/issues/964
I think this havent easy fix, but is possible to allow "force use some php function directly" ? Provide some php function whitelist for these type of issues?
Hi,
& is because of call by reference.
I need to $tbx|tbx show current value and increase $tbx. That's standard call by reference usage.
Calling php function directly (without registerPlugin) it is working fine, but smarty ends support for direct calling php functions. But smarty's registerPlugin do not allow/do not expect call by reference usage so you can't use this simple function now:(
-- Michal Vrábel
Od: "Wolfgang Blessen" @.> Komu: "smarty-php/smarty" @.> Kopie: "Michal Vrábel" @.>, "Author" @.> Odeslané: Úterý, 2. Duben 2024 8:41:07 Předmět: Re: [smarty-php/smarty] registerPlugin modifier unable to call with reference (Issue #980)
Can you try to remove the Ampersand in this function, it looks strange. function tbx($tabindex) { $tabindex++; return $tabindex; }
— Reply to this email directly, [ https://github.com/smarty-php/smarty/issues/980#issuecomment-2031189974 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AE7ZFHCIAK3PO6WNAJOHOCLY3JHIHAVCNFSM6AAAAABFQGVZQOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZRGE4DSOJXGQ | unsubscribe ] . You are receiving this because you authored the thread. Message ID: @.***>
Note: Problem is not with modifier {$tbx|tbx} (I don't need modifier) but I want to call PHP function like {tbx($tbx)}
This type of function call has new deprecation warning. Calling PHP function with referenced variable can be very useful.
Yes the new version broke around 30% of current project if i try to upgrade, is there a way to have direct call of php function? With an extension maybe?
Yes the new version broke around 30% of current project if i try to upgrade, is there a way to have direct call of php function? With an extension maybe?
You cannot use these functions at this time: https://github.com/smarty-php/smarty/issues/961#issuecomment-2020721907
@meesha81 for now, please consdier leaving your function unregistered. That will trigger a deprecation notice, but that shouldn't hurt anyone.
Closing this as this is a duplicate of #964
In v4.5.1 I am not able to use php function called by reference.
php function like (use case: Every function call increase and return the number of tabindex)
In tpl file called like:
Pluign registered by
$this->smarty->registerPlugin("modifier","tbx", "tbx");
But this cannot work because not passed by reference: PHP Warning: tbx(): Argument #1 ($tabindex) must be passed by reference, value given in ...
I am not able to find how to call custom modifier with reference.
If I leave tbx unregistered, there is smarty deprecated warning, but working fine, because of calling pure php function "tbx()".
Please, is it meant that the modifier could be called a reference? Or is there another way to solve this?