Captcha background image-rotate issue (Bugs)

by Auge ⌂, Monday, January 02, 2023, 10:26 (530 days ago) @ vihuna


Sorry for the delayed reply. I looked into the code but had no time to answer.

`imagerotate()` php function fails to return an image object, at least with PHPv7.4 on my hosting.

More specifically, the error occurs specifying 180 degrees as the parameter value (so half of the times the captcha will not be displayed, as designed in function `generate_image()`).

This looks strange. The code is unchanged since ages and the 180-degree-turn itself is similar to the code from the PHP documentation.

The code in modules/captcha/captcha.php (version 20220803.1): $im = imagerotate($im, 180, 0)

The code in the PHP-documentation for imagerotate (variable $degrees dissolved to its value 180): imagerotate($source, 180, 0)

I'm not sure, but I think I remember getting similar errors in the past with older versions of PHP, for some other particular values (negative?). Has anyone else experience similar issues with `imagerotate()`? And what about PHP8?

I do not remember any previous bug report in this regard, even there was made changes for the return value with PHP 8.0. But, to be fair, graphical captchas are generally considered ineffective, so they might be not in use in the most cases/instances anyway.

I have temporally avoided this issue manually changing the value to 179.9 for the parameter. But if It's a common issue, maybe a fix can be added for it: it could be verified that the value returned by `imagerotate()` is not `false`; or a option in the admin panel to not rotate the captcha background?

IMHO checking the return value of the fuction is – independently from the current issue – the way to go. I opened an issue at Github (#658).

Tschö, Auge

Trenne niemals Müll, denn er hat nur eine Silbe!

Complete thread:

 RSS Feed of thread