locutusjs / locutus

Bringing stdlibs of other programming languages to JavaScript for educational purposes

Home Page:https://locutus.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug in PHP parse_str function

JoniJnm opened this issue · comments

There is a bug in the function parse_str

var data = {};
parse_str('a[][b]=1', data);
console.log(data);

The value of data is:

{
    'a': {
        'b': 1
    }
}

But should be:

{
    'a': [
        {
            'b': 1
        }
    ]
}

http://sandbox.onlinephpfunctions.com/code/5286b2e4c9f7aaced6bc5bfade41bf734ed0e315

I've added a pull request with a fix for this issue #369

Thanks for fixing @kukawski!