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

Loss of precision in app_scoped_user_ids caused by json using float64 #19

Closed
afinkenstadt opened this issue Nov 21, 2014 · 0 comments
Closed
Labels

Comments

@afinkenstadt
Copy link

When an app_scoped user_id in a post-Facebook graph 2.0 world exceeds 2^53 (9007199254740992), the id values contained in the Result map[string]interface{} begin to lose their bottom-most bits due to mantissa truncation.

The quick solution in result.go is to use

func MakeResult ... {
        dec := json.NewDecoder(bytes.NewReader(jsonBytes))
        dec.UseNumber()
        err = dec.Decode(&res)

        if err != nil {
                err = fmt.Errorf("cannot format facebook response. %v", err)
                return nil, err
        }

rather than using json.Unmarshal(&res)

@huandu huandu added the bug label Nov 21, 2014
@huandu huandu closed this as completed in 0a1518f Nov 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants