Skip to content
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

smarty v4.5.5 with force_compile=true and deprecation notices #1107

Open
guycalledseven opened this issue Feb 27, 2025 · 0 comments
Open

smarty v4.5.5 with force_compile=true and deprecation notices #1107

guycalledseven opened this issue Feb 27, 2025 · 0 comments

Comments

@guycalledseven
Copy link

I was updating smarty v4.3.4 to v4.5.5 and this deprecation notice started popping up:

Deprecated: Using unregistered function "strpos" in a template is deprecated and will be removed in a future release. Use Smarty::registerPlugin to explicitly register a custom modifier. in smarty4/sysplugins/smarty_internal_templatecompilerbase.php on line 665

When updating from v3 to v4, I've created bunch of modifier functions in custom plugins folder, eg
myplugins/modifier.strpos.php:

function smarty_modifier_strpos($haystack, $needle, $offset = 0)
{
    return (strpos($haystack, $needle, $offset));
}

I registered myplugins folder with addPluginsDir and everything worked.

Now on v4.5.5, if $smarty->force_compile = true; then notices pop up.

They go away if I:

a) set $smarty->force_compile = false

or

b) register manually those modifiers like this

 $smarty->registerPlugin('modifier', 'strpos', 'strpos');

I tried to wrap my head around #813 and #967 but cannot find what is "new proper way" of dealing with custom modifiers.

Why are custom modifier ignored if force_compile is set to true?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant