smarty-php / smarty-php/smarty
Deprecation warning in "is odd by 2" statement
Open
Nobody has claimed this yet.
needs-fix
- Dominant language
- PHP
- Stars
- 2.3k
- Forks
- 709
- PR merge metrics
- No merged PRs in 30d
Description
This statement:
{if $r@total is odd by 2}
is compiled to:
if ((1 & $_smarty_tpl->tpl_vars['r']->total / 2)) {
which produces the warning:
E_DEPRECATED: Implicit conversion from float 7.5 to int loses precision
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the compiler entry point for the Smarty "is odd by" statement and reproduce the shown PHP output and deprecation warning. The work is done when the statement compiles without the float-to-int precision warning while preserving its intended odd-by-two behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100