tj / node-querystring

querystring parser for node and the browser - supporting nesting (used by Express, Connect, etc)
MIT License
455 stars 66 forks source link

qs 0.6.4's sparse array compact injects values from prototype #65

Closed dougwilson closed 11 years ago

dougwilson commented 11 years ago

The new sparse array compaction in qs (that was upgraded when upgraded connect) does for (var i in obj) ret.push(obj[i]); which causes any additions to Array.prototype to be included in the array in array query values.

Array.prototype.random = function () {};
console.dir(require('qs').parse('arr=1&arr=2'));

Results in the unexpected

{ arr: [ '1', '2', [Function] ] }
dougwilson commented 11 years ago

Closed with the merge of #66.