Ticket #4277 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

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

Reported by: joetan Assigned to: rob1n
Priority: normal Milestone: 2.2.1
Component: Administration Version: 2.2
Severity: normal Keywords:
Cc: mdawaffe

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

4277.diff (0.6 kB) - added by rob1n on 05/21/07 04:36:27.

Change History

05/16/07 16:40:57 changed by technosailor

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.

05/16/07 16:45:04 changed by ryan

  • owner changed from anonymous to mdawaffe.

05/16/07 16:59:19 changed by joetan

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.

05/16/07 17:44:02 changed by rob1n

  • milestone set to 2.2.1.

05/16/07 17:50:56 changed by rob1n

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

05/21/07 04:36:27 changed by rob1n

  • attachment 4277.diff added.

05/21/07 04:36:52 changed by rob1n

  • cc set to mdawaffe.
  • owner changed from mdawaffe to rob1n.
  • status changed from new to assigned.

Patch updated.

Michael: look good?

05/21/07 12:56:39 changed by rob1n

  • status changed from assigned to closed.
  • resolution set to fixed.

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