Side navigation
#6481 closed bug (fixed)
Opened April 25, 2010 05:02PM UTC
Closed April 16, 2011 04:13PM UTC
Last modified March 15, 2013 02:32PM UTC
revert $.param should treat empty arrays/objects like empty strings
Reported by: | temp01 | Owned by: | |
---|---|---|---|
Priority: | blocker | Milestone: | 1.6 |
Component: | ajax | Version: | 1.4.2 |
Keywords: | param,regression,ajaxrewrite | Cc: | |
Blocked by: | Blocking: |
Description
$.param ignores the key completly if the value is an empty object or array:
$.param({"foo": {"bar": []} }); // -> "" $.param({"foo": {"bar": [], foo: 1} }); // -> "foo%5Bfoo%5D=1" $.param({"foo": {"bar": {}} }); // -> ""
Empty values should be treated like empty strings i.e. (expected output):
$.param({"foo": {"bar": []} }); // -> "foo%5Bbar%5D=" $.param({"foo": {"bar": [], foo: 1} }); // -> "foo%5Bbar%5D=&foo%5Bfoo%5D=1""foo%5Bfoo%5D=1" $.param({"foo": {"bar": {}} }); // -> "foo%5Bbar%5D="
Attachments (0)
Change History (20)
Changed April 25, 2010 05:54PM UTC by comment:1
Changed September 24, 2010 08:57PM UTC by comment:2
priority: | → undecided |
---|---|
resolution: | → fixed |
status: | new → closed |
Changed November 16, 2010 05:20PM UTC by comment:3
Wish this would have been configurable (like using "traditional") for backwards compatibility.
Changed December 17, 2010 12:10PM UTC by comment:4
This breaking previous behaviour !! You can not simply change this behaviour.. it breaks existing code!
Changed December 17, 2010 05:38PM UTC by comment:5
Like mentioned in http://forum.jquery.com/topic/change-of-behavior-in-1-4-4-because-of-bug-6481, it think the default implementation should be the way the browser does it... there is no element for an empty array (cfr the example with checkboxes with the same name attribute!!! )
Changed December 17, 2010 08:48PM UTC by comment:6
milestone: | 1.4.3 |
---|---|
resolution: | fixed |
status: | closed → reopened |
Reopened for possible reversion. See the discussion in the forum thread. Vote on this ticket (at the top of the page) if you 're interested.
Changed December 27, 2010 06:20AM UTC by comment:7
keywords: | param → param regression |
---|
Changed December 27, 2010 10:37PM UTC by comment:8
keywords: | param regression → param,regression,ajaxrewrite |
---|
Changed February 02, 2011 03:16PM UTC by comment:9
milestone: | → 1.6 |
---|
Changed February 04, 2011 03:42PM UTC by comment:10
Replying to [comment:9 dmethvin]:
This fix seems to have got included in the 1.5 version
Changed February 04, 2011 04:46PM UTC by comment:11
Replying to [comment:10 vig]:
Replying to [comment:9 dmethvin]: This fix seems to have got included in the 1.5 version
The "fix" is in since jQuery 1.4.3 .
The ticket was reopened to evaluate if the fix should be reverted as it breaks previous behavior. Check http://forum.jquery.com/topic/change-of-behavior-in-1-4-4-because-of-bug-6481 for the discussion
Changed February 06, 2011 04:31PM UTC by comment:12
priority: | undecided → blocker |
---|---|
status: | reopened → open |
summary: | $.param should treat empty arrays/objects like empty strings → revert $.param should treat empty arrays/objects like empty strings |
The problem is that there is no way to serialize an empty array in a way that makes sense in the x-www-form-urlencoded format. foo[bar]=
could either mean empty array, empty string, empty object, or null/undefined value, depending upon how the backend chooses to interpret it. Since neither way of serialization is really “correct”, and most backends interpret this as “empty string”, and this breaks traditional mode in quite a bad way (as per the forum thread), I’m marking this to block 1.6 so it can be reverted back to the old behaviour.
Changed March 29, 2011 12:35PM UTC by comment:13
#8687 is a duplicate of this ticket.
Changed April 16, 2011 04:13PM UTC by comment:14
resolution: | → fixed |
---|---|
status: | open → closed |
Fix for this has been backed out - not something that we're going to try and fix.
Changed April 16, 2011 04:13PM UTC by comment:15
type: | enhancement → bug |
---|
Changed April 18, 2011 01:21PM UTC by comment:16
#8902 is a duplicate of this ticket.
Changed May 05, 2011 12:42AM UTC by comment:17
eu nao entendo nada sera que akguem do jquery poderia ajudar e ao enves de faser otras linguas que ninguem usa por favor traduzam em portugues isso assim muito mais pessoas poderao visualizar e usar mais este site e tenha certeza que eu teria prazer em divulgar
Changed May 20, 2011 02:36PM UTC by comment:18
#9360 is a duplicate of this ticket.
Changed September 16, 2011 02:40PM UTC by comment:19
#10292 is a duplicate of this ticket.
Changed March 15, 2013 02:32PM UTC by comment:20
#13611 is a duplicate of this ticket.
Commit link: http://github.com/temp01/jquery/blob/9f0b87f111f34cae54174a88210dea5ffa525c69/src/ajax.js