Page 1 of 1

generating Captchas and PHP >= 5.4 versions

Posted: Wed Dec 25, 2013 7:29 pm
by Timbalu
I changed to debian Whezzy and PHP 5.4 .x version on my server the last weeks and did ever wonder, why I could not get Captchas properly being generated by the spamblock plugin. (You can see them working or failing at the end of the spamblock plugin config page.)

Its not the imagick bug we had had some time ago. It is a changed behaviour in imagecreate() function with PHP > 5.3 versions, generating a [HTTP error.log] PHP Warning: imagejpeg(): Filename cannot be empty in /var/www/path/to/serendipity/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php on line 1339 (line num in official released spamblock version 1.80!)

Please change:

Code: Select all

imagejpeg($image, '', 90); 
to

Code: Select all

imagejpeg($image, NULL, 90);
or
download this file and replace it with yours:
https://raw.github.com/s9y/Serendipity/ ... mblock.php

References:
https://bugs.php.net/bug.php?id=63920

Serendipity 1.7.4-beta in our github repository has been updated.

Addition:
On Line 1303 the image is created with

Code: Select all

$image  = imagecreate($width, $height);
[imagecreate() returns an image identifier representing a blank image of specified size.]
It is often recommended to use imagecreatetruecolor() nowadays, but this would turn our background color black.

Re: generating Captchas and PHP >= 5.4 versions

Posted: Mon Jan 06, 2014 4:40 pm
by garvinhicking
Good ca(p)tch ;) Thanks!