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

With PHP 8.1.0 : Deprecated: Implicit conversion from float 14.5 to int loses precision in Smarty/libs/plugins/modifier.truncate.php on line 45 and 46 and 59 #699

Closed
5cms opened this issue Jan 3, 2022 · 4 comments · Fixed by #725

Comments

@5cms
Copy link

5cms commented Jan 3, 2022

For example try {$long_text|truncate:30:'…':true:true}

To fix - replace all:

$length / 2

with:

intval($length / 2)

in Smarty/libs/plugins/modifier.truncate.php

@pH-7
Copy link
Contributor

pH-7 commented Jan 5, 2022

With what version are you having that issue @5cms? Is it with v4.0.0?

@5cms
Copy link
Author

5cms commented Jan 5, 2022

With what version are you having that issue @5cms? Is it with v4.0.0?

Yes v.4.0.0

PHP 8.1.0

Just try for example {$long_text|truncate:30:'…':true:true}

@5cms 5cms changed the title Deprecated: Implicit conversion from float 14.5 to int loses precision in Smarty/libs/plugins/modifier.truncate.php on line 45 and 46 and 59 In PHP 8.1.0 : Deprecated: Implicit conversion from float 14.5 to int loses precision in Smarty/libs/plugins/modifier.truncate.php on line 45 and 46 and 59 Jan 5, 2022
@5cms 5cms changed the title In PHP 8.1.0 : Deprecated: Implicit conversion from float 14.5 to int loses precision in Smarty/libs/plugins/modifier.truncate.php on line 45 and 46 and 59 With PHP 8.1.0 : Deprecated: Implicit conversion from float 14.5 to int loses precision in Smarty/libs/plugins/modifier.truncate.php on line 45 and 46 and 59 Jan 5, 2022
@marclaporte
Copy link
Contributor

Related: #678

@pH-7
Copy link
Contributor

pH-7 commented Jan 14, 2022

With what version are you having that issue @5cms? Is it with v4.0.0?

Yes v.4.0.0

PHP 8.1.0

Just try for example {$long_text|truncate:30:'…':true:true}

Thanks! This definetly needs a fix indeed 👍

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

Successfully merging a pull request may close this issue.

3 participants