go to bug id or search bugs for
[php-7.1.9/ext/gd/libgd/gd_interpolation.c:1786]: (style) Same expression on both sides of '&&'.
Source code is
const gdFixed f_slop = f_slop_x > 0 && f_slop_x > 0 ?
f_slop_x > f_slop_y ? gd_divfx(f_slop_y, f_slop_x) : gd_divfx(f_slop_x, f_slop_y)
BTW, using nested ternary operators is asking for trouble.
Suggest recode in a simpler way.
Add a Patch
Add a Pull Request
It seems to me that is actually a bug, because
`f_slop_x > 0 && f_slop_x > 0` appears to be supposed to be
`f_slop_x > 0 && f_slop_y > 0` to avoid a subsequent division by
Thanks for reporting this issue!
A test exhibiting the current misbehavior would be welcome.
This very issue has been fixed in external libgd with
<https://github.com/libgd/libgd/commit/dd48286>. However, it seems
to me that a division by zero cannot occur, because `f_slop_y` can
only be zero if `_angle` is 0 or π, but in the former case
`f_slop_x` would be 1, and the latter case cannot happen due to
the switch in gdImageRotateInterpolated().
Anyhow, the respective code has been removed with
<https://github.com/libgd/libgd/commit/2b26be8> to improve the
quality of the rotation result.
Neither of these, nor other, patches regarding gd_interpolation.c
has made it to our bundled libgd yet, unfortunately. I am
uncertain whether 2b26be8 could be backported without some other
patches, so I think it is best to fix the typo for PHP 7.0+, and
to try to sync the whole file for PHP 7.3+.
> BTW, using nested ternary operators is asking for trouble.
> Suggest recode in a simpler way.
As the code is likely to vanish, putting the inner ternary
operation in parentheses appears to be sufficient.
Automatic comment on behalf of firstname.lastname@example.org
Log: Fixed bug #75139 (libgd/gd_interpolation.c:1786: suspicious if ?)