Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with empty array #22

Open
bilogic opened this issue Dec 16, 2022 · 3 comments
Open

Bug with empty array #22

bilogic opened this issue Dec 16, 2022 · 3 comments

Comments

@bilogic
Copy link

bilogic commented Dec 16, 2022

I put a VSCode workspace through this project and it returned the exclude part in a format that json_decode cannot parse.

            "configurations": [
                {
                    "name": "XDebug:9000",
                    "type": "php",
                    "request": "launch",
                    "port": 9000,
                    "exclude": [
                        //                         "!vendor\/bilogic\/**",
                        //                         "**\/vendor\/**"
                    ],
// returned as this, which cannot be parsed
"exclude": [
],
// putting it through the parser again returns this, which is now parsable
"exclude": [],
@adhocore
Copy link
Owner

adhocore commented Dec 17, 2022

maybe due to comment // ? that's not supported

@bilogic
Copy link
Author

bilogic commented Dec 19, 2022

Hi! Maybe let me try to rephrase the problem. I expected this library to strip the original JSON in 1 pass, but it needed 2 passes instead. That's the bug I'm trying to report.

Original

"configurations": [
    {
        "name": "XDebug:9000",
        "type": "php",
        "request": "launch",
        "port": 9000,
        "exclude": [
            //                         "!vendor\/bilogic\/**",
            //                         "**\/vendor\/**"
        ],
    }
]

Output after 1st strip(...), json_decode returns null when trying to parse this output

"configurations": [
    {
        "name": "XDebug:9000",
        "type": "php",
        "request": "launch",
        "port": 9000,
        "exclude": [
        ],
    }
]

Output after 2nd strip(...), json_decode is now able to parse this output

"configurations": [
    {
        "name": "XDebug:9000",
        "type": "php",
        "request": "launch",
        "port": 9000,
        "exclude": [],
    }
]

@adhocore
Copy link
Owner

thanks for explaining

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants