-
6 Oct 2007 4:27 AM #1
[2.0a1] [CLOSED] Ext.urlEncode array bug
[2.0a1] [CLOSED] Ext.urlEncode array bug
Bug at Ext.urlEncode function at array encoding.
need to replace withCode:... for(var i = 0, len = ov.length; i < len; i++) { buf.push(k, "=", encodeURIComponent(ov[i] === undefined ? '' : ov[i]), "&"); } ...
Code:... for(var i = 0, len = ov.length; i < len; i++) { buf.push(k, "[",i,"]=", encodeURIComponent(ov[i] === undefined ? '' : ov[i]), "&"); } ...
P.S. bug come from ext 1.1.1
-
6 Oct 2007 8:03 AM #2
pls explain.
[edit]
your suggested "fix" would cause
to returnCode:Ext.urlEncode({a:1, b:[1, 2, 3]});
instead ofCode:"a=1&b[0]=1&b[1]=2&b[2]=3"
which runs contrary to the intended purpose as defined in the API docs, and would also be interpreted differently by any server side language than what was originally intended.Code:"a=1&b=1&b=2&b=3"
p.s. there's also a reason for the calls to the encodeURIComponent() method throughout the Ext.urlEncode method -- there shouldn't be any "["s and "]"s appearing in an URL-encoded string. are you sure you know what you're doing?
Sencha Docs / Ext 3.x - ( Docs | Examples )
Learning Center / Saki's Examples (for 2.x) / HOWTO - ( Report Bugs | Post Proper Code )
-
6 Oct 2007 11:48 AM #3
Ext does it correctly. Take a look at the spec. I would imagine you are using it with PHP and want it to come in as an array? In that case, the php requirement is that you name the variable with a [] at the end. E.g. b[].


Reply With Quote