Q:

What might cause a POST to wp-admin/async-upload.php to return JSON >and< HTML?

In the media tab, upload of a valid image file results in display of "HTTP error".
Reload of the media tab shows that the image did upload and resize, though.
Browser debug tools show that on upload, browser is making a POST to wp-admin/async-upload.php.  The server responds with a 500 error.  The body of the response, though, is suspicious.  The first part is a JSON structure.  The  JSON structure is immediately followed by an HTML document with the title "Wordpress Error" but an empty body.
Nothing going into the webserver (apache) error log and WP debug mode and increased PHP error/warning verbosity has not been helpful.  Disabling all plugins had no effect on the error.  Tried switching between GD and ImageMagick also with no success.
Relevant software versions:

Wordpress 4.2.2.
PHP 5.5.12-2ubuntu4.4.
Ubuntu Utopic

Any ideas on what might cause async-upload.php to return both JSON and an HTML error document and/or how I might further debug this?

A:

I had the same issue and did not find any information in my debug output.
It worked out, that DOING_AJAX was not defined (I don't know why).
Changing the beginning of async-upload.php from
if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
    define( 'DOING_AJAX', true );
}

to
define( 'DOING_AJAX', true );

worked for me. Maybe I will have a deeper look and find the real root cause.

