Make WordPress Core

Opened 18 years ago

Closed 18 years ago

#4277 closed defect (bug) (fixed)

bug in addArg() in wp-ajax.js causes nothing to happen

Reported by: joetan's profile joetan Owned by: rob1n's profile rob1n
Milestone: 2.2.1 Priority: normal
Severity: normal Version: 2.2
Component: Administration Keywords:
Focuses: Cc:

Description

There is a bug in the addArg() in wp-includes/wp-ajax.js

on line 30, the variable a is basically incorrectly typed:
var a = [];

it should be instead:
var a = $H();

the function definition should be:

addArg: function(key, value) {
var a = $H();
a[encodeURIComponent(key)] = encodeURIComponent(value);
this.options.parameters = $H(this.options.parameters).merge(a);
}

Attachments (1)

4277.diff (582 bytes) - added by rob1n 18 years ago.

Download all attachments as: .zip

Change History (8)

#1 @technosailor
18 years ago

No idea what the problem is you're encountering, however I've attached the diff of your changes for the sake of ease for the devs.

#2 @ryan
18 years ago

  • Owner changed from anonymous to mdawaffe

#3 @joetan
18 years ago

thanks technosailor.

To help clarify, the function should basically add a new key into the this.options.parameters hash variable, but it never gets updated with the new key because "a" was created as []

I'm encountering this bug with a plugin I'm working on, which does some ajax stuff. It doesn't appear that this function is actually used anywhere else within the WordPress codebase.

#4 @rob1n
18 years ago

  • Milestone set to 2.2.1

#5 @rob1n
18 years ago

I think that should be a = $H() (note parenthesis, not square brackets).

@rob1n
18 years ago

#6 @rob1n
18 years ago

  • Cc mdawaffe added
  • Owner changed from mdawaffe to rob1n
  • Status changed from new to assigned

Patch updated.

Michael: look good?

#7 @rob1n
18 years ago

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

(In [5498]) Fix wp-ajax.js addArg's hashes. Props technosailor. fixes #4277

Note: See TracTickets for help on using tickets.