WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
[resolved] How to fix solid black images from Really Simple CAPTCHA (7 posts)

  1. dawnmew
    Member
    Posted 2 years ago #

    Some of you may have noticed that Really Simple CAPTCHA (and, by extension, the CAPTCHA system in Contact Form 7) is outputting solid black images, with no visible codes on them, thus making them pretty unusable.

    I traced the issue back to a function used by Really Simple CAPTCHA, and luckily, it's easy to fix.

    Go to your Plugins page and choose to "Edit" Really Simple CAPTCHA.

    Find this line: imagefill( $im, 0, 0, $bg );

    Replace it with this line: imagefilledrectangle($im,0,0,$this->img_size[0]-1,$this->img_size[1]-1,$bg);

    Save the changes. It should be fixed.

    This issue is caused by imagefill(), which was buggy in certain versions of PHP, especially the earlier 5.2.* versions. Replacing it with an equivalent imagefilledrectangle() call fixes the issue, at least until you upgrade again.

    If the plugin author is reading this, please consider replacing imagefill() with imagefilledrectangle() in the plugin -- imagefill() was broken in several PHP versions, while imagefilledrectangle() has always worked correctly.

    http://wordpress.org/extend/plugins/contact-form-7/

  2. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 2 years ago #

    Note: The current version of Really Simple CAPTCHA and Contact Form 7 require WordPress 3.2 or higher. WordPress 3.2 requires PHP 5.2.4 or higher. So now it's very rare to see that kind of trouble.

  3. ddust984
    Member
    Posted 2 years ago #

    Well done man yous ave me!

  4. dawnmew
    Member
    Posted 2 years ago #

    @Takayuki: My server runs 5.2.6 and I'm using the most recent version of WordPress (3.3.1), and I encountered the problem there anyway. I'm not completely sure which version this bug was fixed in, but it's still in circulation.

  5. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 2 years ago #

    If you know some official reports state that it's due to a bug of imagefill in some versions of PHP and you can fix it by using imagefilledrectangle instead, please let me know that. Without them I won't replace them in the plugin code. It might be more buggy, right?

  6. dawnmew
    Member
    Posted 2 years ago #

    @Takayuki: Details are sporadic, but imagefill has been the subject of several bugs fixed between 5.2.4 and now.

    https://bugs.php.net/bug.php?id=51128
    https://bugs.php.net/bug.php?id=51671
    https://bugs.php.net/bug.php?id=60160

    Admittedly none of these specify my exact problem, but it sounds like it's probably the same root cause. In all cases, imagefilledrectangle() has worked as a substitute, and in one of those, was the suggested workaround until the patch.

  7. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 2 years ago #

    Thank you for the information. I'll check them.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic