Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#20024 closed defect (bug) (fixed)

WP_Ajax_Response / send() / extra data retrieved

Reported by: arena Owned by: arena
Milestone: 3.4 Priority: normal
Severity: normal Version: 3.3.1
Component: General Keywords: reporter-feedback
Focuses: Cc:


on last trunk (3.4-alpha-19904)

when using class WP_Ajax_Response and send method

(i am using FF 10.0.1)

the data retrieved are :

<?xml version='1.0' standalone='yes'?><wp_ajax>...</wp_ajax><!DOCTYPE html>
<!-- Ticket #11289, IE bug fix: always pad the error page with enough characters such that it is greater than 512 bytes, even after gzip compression abcdefghijklmnopqrstuvwxyz1234567890aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz11223344556677889900abacbcbdcdcededfefegfgfhghgihihjijikjkjlklkmlmlnmnmononpopoqpqprqrqsrsrtstsubcbcdcdedefefgfabcadefbghicjkldmnoepqrfstugvwxhyz1i234j567k890laabmbccnddeoeffpgghqhiirjjksklltmmnunoovppqwqrrxsstytuuzvvw0wxx1yyz2z113223434455666777889890091abc2def3ghi4jkl5mno6pqr7stu8vwx9yz11aab2bcc3dd4ee5ff6gg7hh8ii9j0jk1kl2lmm3nnoo4p5pq6qrr7ss8tt9uuvv0wwx1x2yyzz13aba4cbcb5dcdc6dedfef8egf9gfh0ghg1ihi2hji3jik4jkj5lkl6kml7mln8mnm9ono
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>WordPress &rsaquo; Error</title>
	<style type="text/css">
		html {
			background: #f9f9f9;
		body {
			background: #fff;
			color: #333;
			font-family: sans-serif;
			margin: 2em auto;
			padding: 1em 2em;
			-webkit-border-radius: 3px;
			border-radius: 3px;
			border: 1px solid #dfdfdf;
			max-width: 700px;
		#error-page {
			margin-top: 50px;
		#error-page p {
			font-size: 14px;
			line-height: 1.5;
			margin: 25px 0 20px;
		#error-page code {
			font-family: Consolas, Monaco, monospace;
		ul li {
			margin-bottom: 10px;
			font-size: 14px ;
		a {
			color: #21759B;
			text-decoration: none;
		a:hover {
			color: #D54E21;

		.button {
			font-family: sans-serif;
			text-decoration: none;
			font-size: 14px !important;
			line-height: 16px;
			padding: 6px 12px;
			cursor: pointer;
			border: 1px solid #bbb;
			color: #464646;
			-webkit-border-radius: 15px;
			border-radius: 15px;
			-moz-box-sizing: content-box;
			-webkit-box-sizing: content-box;
			box-sizing: content-box;
			background-color: #f5f5f5;
			background-image: -ms-linear-gradient(top, #ffffff, #f2f2f2);
			background-image: -moz-linear-gradient(top, #ffffff, #f2f2f2);
			background-image: -o-linear-gradient(top, #ffffff, #f2f2f2);
			background-image: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#f2f2f2));
			background-image: -webkit-linear-gradient(top, #ffffff, #f2f2f2);
			background-image: linear-gradient(top, #ffffff, #f2f2f2);

		.button:hover {
			color: #000;
			border-color: #666;

		.button:active {
			background-image: -ms-linear-gradient(top, #f2f2f2, #ffffff);
			background-image: -moz-linear-gradient(top, #f2f2f2, #ffffff);
			background-image: -o-linear-gradient(top, #f2f2f2, #ffffff);
			background-image: -webkit-gradient(linear, left top, left bottom, from(#f2f2f2), to(#ffffff));
			background-image: -webkit-linear-gradient(top, #f2f2f2, #ffffff);
			background-image: linear-gradient(top, #f2f2f2, #ffffff);

<body id="error-page">

Change History (5)

#1 @kurtpayne
5 years ago

  • Cc kpayne@… added
  • Keywords reporter-feedback added
  • Severity changed from major to normal

Are you using this in a plugin?

WP_Ajax_Response::send() calls wp_die() at the end. The default behavior for wp_die() with no arguments is to exit the script. If you define a custom ajax die handler in a plugin, though, this could account for extra output.

If that isn't the case, can you please post steps to reproduce?

#2 @nacin
5 years ago

  • Milestone changed from Awaiting Review to 3.4

Looks legit to me in the case where WP_Ajax_Response is used outside of the standard admin-ajax.php handler. We took this into account for check_ajax_referer(), see [19801/trunk/wp-includes/pluggable.php], but not for this, see [19801/trunk/wp-includes/class-wp-ajax-response.php].

#3 @nacin
5 years ago

In [19911]:

Make sure we are using the admin-ajax handler when we call wp_die() for WP_Ajax_Response. see #20024.

#4 @nacin
5 years ago

arena, [19911] should fix your problem.

#5 @arena
5 years ago

  • Resolution set to fixed
  • Status changed from new to closed

@nacin, looks good now. thank you

Note: See TracTickets for help on using tickets.