New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
registerPlugin modifier unable to call with reference #980
Comments
I have found it is propably similar to |
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, [ #980 (comment) | 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)} |
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? |
You cannot use these functions at this time: |
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?
The text was updated successfully, but these errors were encountered: