Skip to content

Commit 9769d3f

Browse files
committed
Merge pull request locutusjs#28 from MIO-KODUKI/master
parse_str: bugfixed
2 parents 27caffc + 3ab15ee commit 9769d3f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

functions/strings/parse_str.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ function parse_str (str, array) {
1111
// + input by: Dreamer
1212
// + bugfixed by: Brett Zamir (http://brett-zamir.me)
1313
// % note 1: When no argument is specified, will put variables in global scope.
14+
// + bugfixed by: MIO_KODUKI (http://mio-koduki.blogspot.com/)
15+
// % note 1: When a particular argument has been passed, and the returned value is different parse_str of PHP. For example, a=b=c&d====c
1416
// * example 1: var arr = {};
1517
// * example 1: parse_str('first=foo&second=bar', arr);
1618
// * results 1: arr == { first: 'foo', second: 'bar' }
@@ -34,8 +36,8 @@ function parse_str (str, array) {
3436
if (tmp.length < 2) {
3537
tmp = [tmp, ''];
3638
}
37-
key = fixStr(tmp[0]);
38-
value = fixStr(tmp[1]);
39+
key = fixStr(tmp.shift());
40+
value = fixStr(tmp.join(glue1));
3941
while (key.charAt(0) === ' ') {
4042
key = key.substr(1);
4143
}

0 commit comments

Comments
 (0)