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

Why strlen modifier not use mb_string? #1065

Open
yourchoice opened this issue Sep 13, 2024 · 1 comment
Open

Why strlen modifier not use mb_string? #1065

yourchoice opened this issue Sep 13, 2024 · 1 comment

Comments

@yourchoice
Copy link

yourchoice commented Sep 13, 2024

Why "strlen" modifier not use mb_strlen() instead of strlen() function ?

To have something like :

function smarty_modifier_strlen($string) {
    if (function_exists('mb_strlen')) {
        return mb_strlen($string);
    } else {
        return strlen($string);
    }
}
@yourchoice
Copy link
Author

I see new StrlenModifierCompiler looks like:

class StrlenModifierCompiler extends Base {

	public function compile($params, \Smarty\Compiler\Template $compiler) {
		return 'strlen((string) ' . $params[0] . ')';
	}

}

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