Events Made Easy Forums Generic CAPTCHA image do not show – fix here available

Tagged: 

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #58203
    Anonymous
    Inactive

    When I use placeholder #_CAPTCHA in reservation form, GD lib generate image, but image wont show in browser.

    Please, fix it by code bellow.

    To fix this bug, do this:

    eme_functions.php

    function eme_captcha_generate() {

    // give image back
    ob_clean(); // <—- BUG FIX
    header (“Content-type: image/gif”);
    imagegif($im);
    imagedestroy($im);
    exit;
    }

    #58204
    Franky
    Keymaster

    Why would ob_clean be needed there?

    #58205
    Anonymous
    Inactive

    In my case, if there is not ob_clean function, header or any other data are sent, before GD lib generate captcha image and source link has invalid content. Web browser show only small black square, no captcha code. Probably, there is some colision between this and other plugin.

    #58206
    Franky
    Keymaster

    Well, I don’t use ob_start anywhere, so ob_clean is not something I’d need here as well.
    Indeed either another plugin (or your theme with empty lines) might be responsible, and that should be corrected.

    #58251
    Anonymous
    Inactive

    Sorry, error in my wordpress template.

    response of server was:
    77u/<image data>

    77u/ is UTF8 BOM identification.

    I use czech language, edit some teplate files and save in format UTF8 with BOM!

    To fix this I use Notepad++, choose menu-format-convert to UTF8 (without BOM)
    In status bar of app was shown: ANSI as UTF8

    This working properly

    #63534
    Anonymous
    Inactive

    I had to insert the ob_clean to have the captcha displayed.
    If I call directly the
    [URL]/?eme_captcha=generate&f=49a075d52a3fb455454ff957861c54511a3e5392587712&ts=1638664168

    I receive a 0x0 gif image when I dont use the ob_clean

    How to find where the incorrect char (or blank line) is added?

    Thanks,
    Stephan

    #63535
    Anonymous
    Inactive

    OK, I found my problem:
    Analysing the GIF returned by the script, I saw the GIF begin with “\xef bb bf”, the gif should begin with “GIF”. So there are 3 hex chars before the file.
    This is the BOM encoding for UTF8, it means that a file is encoded in “UTF8 with BOM”.

    Searched through all my files with
    grep -R $’\UFEFF’ | grep php

    The wp-config.php was the culprit. Problem solved.
    Ref: https://www.herongyang.com/Unicode/Notepad-Byte-Order-Mark-BOM-FEFF-EFBBBF.html

    #63536
    Franky
    Keymaster

    Yes, I make sure the theme isn’t responsible for captcha generation errors, but if the issue was in wp-config.php then many things that create images on the fly would not have worked.

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘Generic’ is closed to new topics and replies.
Scroll to Top