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 in isArray implementation #3

Closed
jkodumal opened this issue Aug 3, 2014 · 4 comments
Closed

Bug in isArray implementation #3

jkodumal opened this issue Aug 3, 2014 · 4 comments

Comments

@jkodumal
Copy link
Contributor

jkodumal commented Aug 3, 2014

The body of isArray is as follows:

    for _, c := range buf {
        switch c {
        case ' ':
        case '\n':
        case '\t':
            continue
        case '[':
            return true
        default:
            break
        }
    }

This seems innocuous enough, but the break is defined to be a break on the switch statement, not the for loop. This means that calls to isArray will always return true if there's a [ anywhere in the JSON document.

@evanphx
Copy link
Owner

evanphx commented Aug 4, 2014

Ah! Oops. Yeah, looks like a definite bug.

@jkodumal
Copy link
Contributor Author

jkodumal commented Aug 4, 2014

I'll open a pull request. I've also noticed that paths containing array indices aren't completely supported either-- will submit a PR for that as well.

@klauspost
Copy link
Contributor

Is this closed by #4?

@evanphx
Copy link
Owner

evanphx commented Sep 5, 2014

Yup!

@evanphx evanphx closed this as completed Sep 5, 2014
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

3 participants