WordPress.org

Support

Support » Plugins and Hacks » Drag & Drop for Post Thumbnails » [Plugin: Drag & Drop for Post Thumbnails] Brilliant plugin, what is the zero character?

[Plugin: Drag & Drop for Post Thumbnails] Brilliant plugin, what is the zero character?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Tobias Nygren

    @tobiasn

    Hi c.note!

    Sorry for my late reply. This little zerochar is bugging me to death. I don’t know why this happens yet, but I tried a lot of things and I think the problem is related to the way I parse the output. Hopefully I will figure this out until next release. (FYI: I’m using nonces to authenticate just as the rest of the admin, so this is as secure as rest of wp admin).

    Tobias, I have a clue on the origin of that stray zero char …

    Stick this in your browser’s address bar:
    http://tobiasnygren.se/wp-admin/admin-ajax.php

    Use any other wordpress site’s domain name … the admin-ajax.php must be returning a false or zero after some internal function.

    Plugin Author Tobias Nygren

    @tobiasn

    Thank you so much for digging Ron! That means I have to filter the return data, I have to look in to this asap.

    “If the AJAX request fails when the request url is wp-admin/admin-ajax.php, it will return either -1 or 0 depending on the reason it failed. Additionally, if an AJAX request succeeds, it will return a 0.”
    http://codex.wordpress.org/AJAX_in_Plugins#Error_Return_Values

    I’m working with some ajax post/response logic and notice that occasionally I get a zero char in my response when the php-ajax side does not execute a die() or exit() statement. It can be successful, but still not terminated properly. Hope this is another useful clue.

    Hello Tobias!

    This problem is easily resolved by using die(); instead of a traditional return/echo in the admin ajax function. If you do not run die it will continue to execute, therefore returning unwanted numerics. Let me know how this works out for you 🙂

    Best regards,
    Jonathan

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Drag & Drop for Post Thumbnails] Brilliant plugin, what is the zero character?’ is closed to new replies.
Skip to toolbar